How to determine the Boost version on a system?

Question: Is there a quick way to determine the version of the Boost C++ libraries on a system?
Answer: Boost Informational Macros. You need: BOOST_VERSION
Comment: If you want to figure it out manually (rather than in-code), the go to the include directory, and open up version.hpp. `BOOST_VERSION` takes a bit of deciphering, but `BOOST_LIB_VERSION` is pretty clear. The value of mine is currently `"1_42"`
Comment: You can quickly look up the current value via e.g. `echo -e '#include \nBOOST_VERSION' | gcc -x c++ -E  -` - for example on Fedora 26: 106300 (i.e. 1.63)
Comment: Also in linux, `dpkg -S /usr/include/boost/version.hpp`
Comment: In linux, using "ldd yourprogramname" will often show you which version of boost was linked to your program (which has the possibility of indicating a difference from the header, though it's unlikely to be different).
Answer: Include #include <boost/version.hpp>
std::cout << "Using Boost "
          << BOOST_VERSION / 100000     << "."  // major version
          << BOOST_VERSION / 100 % 1000 << "."  // minor version
          << BOOST_VERSION % 100                // patch level
          << std::endl;

Possible output: Using Boost 1.75.0
Tested with Boost 1.51.0 to 1.63, 1.71.0 and 1.76.0 to 1.83.0
Comment: Why don't you just update your answer with something like: 'Works with all Boost versions (tested version 1.51  to 1.63 ).' - instead of overflowing the comment section ...
Comment: what a dedication sir @Vertexwahn
Comment: To break @Vertexwahn 's streak: Works also with [1.60.0](http://www.boost.org/doc/libs/1_60_0/boost/version.hpp) and [1.61.0](http://www.boost.org/doc/libs/1_61_0/boost/version.hpp).
Comment: @Vertexwahn They should hire you for any kind of release changes.
Answer: If you only need to know for your own information, just look in /usr/include/boost/version.hpp (Ubuntu 13.10) and read the information directly
Answer: #include <boost/version.hpp>
#include <iostream>
#include <iomanip>

int main()
{
    std::cout << "Boost version: "
          << BOOST_VERSION / 100000
          << "."
          << BOOST_VERSION / 100 % 1000
          << "."
          << BOOST_VERSION % 100
          << std::endl;
    return 0;
}

Update: the answer has been fixed.
Comment: Why not just: `std::cout << "Boost version: " << BOOST_LIB_VERSION;`?
Comment: Running this code outputted "Boost version: 0.199.60" whereas T.E.D.'s version outputted "Boost version: 1_48"
Comment: This doesn't work.  Why would any one upvote this?  Has anybody actually run this code and gotten useful output?  I guess people see "hex" and figure it must be correct.
Comment: Except now it's just the same thing as [the other answer](http://stackoverflow.com/a/13084616/365237)...
Comment: This is not correct. Boost version is stored decimally, not hexagonally.
Comment: The answer by Vertexwahn is how the docs say to use BOOST_VERSION
Answer: Depending on how you have installed boost and what OS you are running you could also try the following:
dpkg -s libboost-dev | grep 'Version'

Comment: Is  `libboost-dev` the same as "boost"? Because I have a lot in `/usr/include/boost` but your command gives `is not installed`.
Answer: Boost installed on OS X using homebrew has desired version.hpp file in /usr/local/Cellar/boost/<version>/include/boost/version.hpp (note, that the version is already mentioned in path).
I guess the fastest way to determine version on any UNIX-like system will be to search for boost in /usr:
find /usr -name "boost"
Comment: My include was empty so I used the version at the end of the lib files: `find / -name *boost*.so* 2>/dev/null`
Answer: As to me, you can first(find version.hpp the version variable is in it, if you know where it is(in ubuntu it usually in /usr/include/boost/version.hpp by default install)):
 locate `boost/version.hpp`

Second show it's version by:
 grep BOOST_LIB_VERSION /usr/include/boost/version.hpp

or
  grep BOOST_VERSION /usr/include/boost/version.hpp.

As to me, I have two version boost installed in my system. Output as below:
xy@xy:~$ locate boost/version.hpp |grep boost

/home/xy/boost_install/boost_1_61_0/boost/version.hpp
/home/xy/boost_install/lib/include/boost/version.hpp
/usr/include/boost/version.hpp

xy@xy:~$ grep BOOST_VERSION /usr/include/boost/version.hpp
#ifndef BOOST_VERSION_HPP
#define BOOST_VERSION_HPP
//  BOOST_VERSION % 100 is the patch level
//  BOOST_VERSION / 100 % 1000 is the minor version
//  BOOST_VERSION / 100000 is the major version
#define BOOST_VERSION 105800
//  BOOST_LIB_VERSION must be defined to be the same as BOOST_VERSION

# or this way more readable
xy@xy:~$ grep BOOST_LIB_VERSION /usr/include/boost/version.hpp
//  BOOST_LIB_VERSION must be defined to be the same as BOOST_VERSION
#define BOOST_LIB_VERSION "1_58"

Show local installed version:
xy@xy:~$ grep BOOST_LIB_VERSION /home/xy/boost_install/lib/include/boost/version.hpp
//  BOOST_LIB_VERSION must be defined to be the same as BOOST_VERSION
#define BOOST_LIB_VERSION "1_61"

Answer: I stugeled to find out the boost version number in bash.
Ended up doing following, which stores the version code in a variable, supressing the errors. This uses the example from maxschlepzig in the comments of the accepted answer. (Can not comment, don't have 50 Rep)
I know this has been answered long time ago. But I couldn't find how to do it in bash anywhere. So I thought this might help someone with the same problem. Also this should work no matter where boost is installed, as long as the comiler can find it. And it will give you the version number that is acutally used by the comiler, when you have multiple versions installed.
{
VERS=$(echo -e '#include <boost/version.hpp>\nBOOST_VERSION' | gcc -s -x c++ -E - | grep "^[^#;]")
} &> /dev/null

Comment: Nice approach and like that it uses  rather than explicit path.
Answer: @Vertexwahns answer, but written in bash. For the people who are lazy:
boost_version=$(cat /usr/include/boost/version.hpp | grep define | grep "BOOST_VERSION " | cut -d' ' -f3)
echo "installed boost version: $(echo "$boost_version / 100000" | bc).$(echo "$boost_version / 100 % 1000" | bc).$(echo "$boost_version % 100 " | bc)"

Gives me installed boost version: 1.71.0
Answer: Another way to get current boost version (Linux Ubuntu):
~$ dpkg -s libboost-dev | grep Version
Version: 184.108.40.206ubuntu1

Ref:
https://www.osetc.com/en/how-to-install-boost-on-ubuntu-16-04-18-04-linux.html
Answer: cat /usr/local/include/boost/version.hpp  | grep BOOST_LIB_VERSION
Comment: please elaborate
Answer: If one installed boost on macOS via Homebrew, one is likely to see the installed boost version(s) with:
ls /usr/local/Cellar/boost*

Answer: Might be already answered, but you can try this simple program to determine if and what installation of boost you have :
#include<boost/version.hpp>
#include<iostream>
using namespace std;
int main()
{
cout<<BOOST_VERSION<<endl;
return 0;
}

Comment: It _has_ already been answered, almost a decade ago, and you can plainly see that by simply reading this page.
Answer: All the answers above are pretty good. However, I wondered if I can type in my terminal simple command boost --version just like I usually do for any other tool. So I implemented it in C++:
#include <iostream>
#include <string>
#include <boost/version.hpp>

int main(int argc, char *argv[])
{
    if (argc >= 2) {
        if (std::string arg(argv[1]); arg == "--version" || arg == "-v") {
            auto major_version = BOOST_VERSION / 100000;
            auto minor_version = BOOST_VERSION / 100 % 1000;
            auto patch_version = BOOST_VERSION % 100;

            std::cout
                << "Boost library version: "
                << major_version << '.'
                << minor_version << '.'
                << patch_version << '\n';
        }
        else if (arg == "--help" || arg == "-h") {
            std::cout
                << "This is small helper utility to figure out installed Boost version.\n"
                << "Use --version parameter to print installed Boost library version.\n\n"
                << "Boost is a set of libraries for the C++ programming language that provides\n"
                << "support for tasks and structures such as linear algebra, pseudorandom number\n"
                << "generation, multithreading, image processing, regular expressions, and unit testing.\n"
                << "If you want to know more about Boost please visit https://www.boost.org\n";
        }
        else {
            std::cout
                << "Unknown parameter " << arg
                << ". Use --version or --help as a parameter instead.\n";
        }
    }
}

Then I built it using following command:
g++ -Wextra -Wall -pedantic -std=c++20 main.cpp -o boost
to get executable named just "boost". When it has been done I copied this executable to my /usr/bin using following command:
sudo cp -r ./boost /usr/bin
Since then I'm able to type in my terminal boost --version to figure out installed Boost version.
Answer: Can it really be that no one has suggested that, at least from the advent of Boost Predef with Boost 1.55.0, we can:

#include <boost/predef.h>
#include <boost/version.hpp>
...
#if BOOST_VERSION < BOOST_VERSION_NUMBER(1, 67, 0)

... if we wanted, for example, to know whether a work around was needed for this ~2038 problem in Boost DateTime?  Perhaps it's a minority-interest reading of the question, but it's the one that brought me here.
No, and it's as well they shouldn't, because it doesn't work.  The BOOST_VERSION_NUMBER macro from Boost Predef is incompatible with Boost's own version number!  I don't see that documented as recently as Boost 1.84.0.  I like the two stage idea, though, so I'll use:
#include <boost/version.hpp>
...
#define BOOSTS_OWN_VERSION_NUMBER(major, minor, patch) ((major) * 100 * 1000 + (minor) * 100 + (patch))
#if BOOST_VERSION < BOOSTS_OWN_VERSION_NUMBER(1, 67, 0)


Can an app detect a radio signal when running in the background with the phone in standby mode?

Question: Also, could such an app detect a specific frequency (using either the cell tower antenna or wi-fi sniffer)?  I would like to use a radio transmittor to activate an app to perform a function even while the phone is in standby mode.  Thank you in advance for your assistance.
Answer: The cell radio in a mobile phone is designed only to receive and transmit at certain frequencies. It can't pick up an arbitrary transmission such as a radio car key, regardless of whether it's in standby or fully on. It's very unlikely that you could even do this by replacing the device's radio firmware, let alone with a normal app. At the same time, even if you can modify the transmitter, running it on a licensed mobile phone frequency would likely constitute a criminal offence.
The same goes for the Wi-Fi and Bluetooth radios too.


Assembly Version Mismatch error

Question: i am running a Web Application which shows assembly mismatch error during loading. I looked into my hard drive and application path to find out the false assembly but i have the right version of assembly everywhere i.e. in GAC, My Application path and all.
Now i want to use fiddler or some other same kind of tool to trace out from where the false assembly is getting loaded and create problem. Is it possible with fiddler or there is some other tool available which can help me?
Answer: Check out the Fusion Log Viewer.

Assembly Version Mismatch error


I have to do it until/by tomorrow. Why both seem to be common?

Question: I have always thought that the correct one is "I have to do it by tomorrow" as "by" is used for some point in the future while "until" is used when something longs until now/that time.
Is that correct?
Answer: No, that is not really correct.
Doing something 'by' tomorrow means that the deadline for completion is tomorrow. This is delivery focused - aiming to complete a task, write a report, deliver a product etc.
Doing something 'until' tomorrow means you continue carrying out the activity until tomorrow. This doesn't imply a deliverable or an end product.
Comment: Thanks, but for example "I need that report by Friday" is definitely "by" - I cannot spot the difference between this and the one in the example. Also "I have to do it by tomorrow" is not grammatical? Because it has much mroe hits on Google than "until".
Comment: They are both grammatical but mean entirely different things. You would not say, "I need that report until tomorrow" (well, you could, but that would imply you are giving it back tomorrow...)
Comment: Oh righ, it would mean "I need to keep the record until tomorrow". So which one is actually correct - I have to do my homework until/by Friday?
Comment: I have to do my homework by Friday. I have to carry out the activity to produce that homework until Friday.


How many distinct functions can be defined from set A to B?

Question: In my discrete mathematics class our notes say that between set $A$ (having $6$ elements) and set $B$ (having $8$ elements), there are $8^6$ distinct functions that can be formed, in other words: $|B|^{|A|}$ distinct functions. But no explanation is offered and I can't seem to figure out why this is true. Can anyone elaborate?
Answer: A function on a set involves running the function on every element of the set A, each one producing some result in the set B.  So, for the first run, every element of A gets mapped to an element in B.  The question becomes, how many different mappings, all using every element of the set A, can we come up with?  Take this example, mapping a 2 element set A, to a 3 element set B.  There are 9 different ways, all beginning with both 1 and 2, that result in some different combination of mappings over to B.

The number of functions from A to B is |B|^|A|, or $3^2$ = 9.
Comment: Very thorough. Sadly I doubt the original poster will see it though.
Comment: Very good graphical approach. Helped me understand that the number of functions from set A is the number of functions counted silmutanuously
Comment: Congrats for your fifth badge !
Comment: So if the output for 1 remains the same but the output of 2 changes then is it considered as a new function? So is this the reason why we are multiplying instead of adding?
Answer: Let set $A$ have $a$ elements and set $B$ have $b$ elements. Each element in $A$ has $b$ choices to be mapped to. Each such choice gives you a unique function. Since each element has $b$ choices, the total number of functions from $A$ to $B$ is
$$\underbrace{b \times b \times b \times \cdots b}_{a \text{ times}} = b^a$$
Answer: Let's say for concreteness that $A$ is the set $\{p,q,r,s,t,u\}$, and $B$ is a set with $8$ elements distinct from those of $A$. Let's try to define a function $f:A\to B$.
What is $f(p)$?  It could be any element of $B$, so we have 8 choices.
What is $f(q)$?  It could be any element of $B$, so we have 8 choices.
...
What is $f(u)$?  It could be any element of $B$, so we have 8 choices.
So there are $8\cdot8\cdot8\cdot8\cdot8\cdot8 = 8^6$ ways to choose values for $f$, and each possible set of choices defines a different function $f$.  So that's how many functions there are.
Comment: Is the set of all such functions denoted by $B^A$?
Comment: That is correct.
Answer: You know that a function gives a unique value for each entry, if the function $f\colon A\to B$ where $|A|=n, ~|B|=m$, then for $a\in A$, you have $m$ values to assign. then for every $a\in A$, you can take |B| values, since $|A|$ have $n$ elements, then you have $|B|^{|A|}$ choices.
Answer: The cardinality of $B^A$ is the same if $A$ (resp. $B$) is replaced with a set containing the same number of elements as  $A$ (resp. $B$).
Set $b = |B$|. When $b \lt 2$ there is little that needs to be addressed, so we assume $b \ge 2$. Assume $|A| = n$.
A well known result of elementary number theory states that if $a$ is a natural number and $0 \le a \lt b^n$ then it has one and only one base-$\text{b}$ representation,
$$\tag 1  a = \sum_{k=0}^{n-1} x_k\, b^k \text{ with } 0 \le x_k \lt b$$
Associate to every $a$ in the initial integer interval $[0, b^n)$ the set of ordered pairs
$$\tag 2  \{(k,x_k) \, | \, 0 \le k \lt n \text{ and the base-}b \text{ representation of } a \text{ is given by (1)}\}$$
This association is a bijective enumeration of $[0, b^n)$ onto the set of all functions
mapping $[0,n-1]$ to $[0,b-1]$.
Since $[0, b^n)$ has $b^n$ elements, we know how to count all the functions from one finite set into another.
Answer: It follows from the definition that there is a bijection from $\mathrm{Func}(A,B)$ to $\prod_{i \in A}B_i$ where each $B_i$ is a copy of $B$. Thus the cardinal of $\mathrm{Func}(A,B)$ is equal to the cardinal of $\prod_{i \in A}B_i$. In particular, when $A,B$ are finite sets, we have $$ \# \ \mathrm{Func}(A,B) = \# B^{\# A}. $$


PRESTIGIO PMT7177 TABLET STUCK ON BOOT SCREEN AND CAN'T BE CONNECTED TO PC(connecting/disconnecting continuously)

Question: Unbootable PRESTIGIO MULTIPAD 4 DIAMOND PMT7177-3G tablet diagnosis(my child device) :
When power off :
a) charging;
b) accessing recovery menu, three ways appear on the screen: recovery mode, fast boot, normal boot. Choosing first, freeze on doing anything, choosing the other two it stuck on boot screen.
When power on :
a) freeze on boot screen;
b) after connecting to a desktop/laptop with a various number of usb cable, freeze on boot screen and constantly connecting and disconnecting.
The usb ports from desktop/laptop are ok(I've tried to connect the my phone in all usb ports of pc whith all usb cable that I have and everything is ok). In device manager the tablet is detected for a second, after that disappear because is connecting / disconnecting over and over again from PC. It simply can't stay connected.
I tried to disable the usb settings from power option plan, but nothing happened. My first concern is to connect the tablet to a desktop/laptop+flashing firmware. Any suggestions/tutorial on how to do it, will be highly appreciate. Tks.
Answer: Basically there's a method that works always. You need to go into recovery mode and reset the device to factory settings. How this is done varies from device to device so you have to look that up.A warning: Doing a factory reset will wipe everything from your device.
Comment: Tks for answer, but like I described in the post, I can not accessing recovery menu(power + volume up in my case)The tablet is unresponsive. I wanted to flash the firmware, but it can't stay connected to pc through usb cable. It simply connecting / disconnecting over and over again. As the PC is not recognizing the device I want to find a way to connect the tablet to pc. That is all that I look for.
Comment: If you can't even do a factory reset then it is pretty much a lost case.
Comment: Thought so mate ! Tks anyway.


Can't understand a variable in the formula used to determine CDTY to set duty cycle of PWM on cortex M3 (SAM3X8E)

Question: I want to generate complementary PWM on an Arduino due. For that purpose I am programming the cortex M3 using the PWMC library. In order to set the duty cycle I have to set a value in CDTY channel register of the Cortex M3.
The formula for calculating the duty cycle of a center aligned PWM is given in the SAM3X datasheet as,

Now I don't know what is the value of the variable "fchannel_x_clock" in this formula. If I get to know that, I can easily find the value of the CDTY to get my desired duty cycle using the above formula.
Link to the complete datasheet: http://www.atmel.com/Images/Atmel-11057-32-bit-Cortex-M3-Microcontroller-SAM3X-SAM3A_Datasheet.pdf
The formula above is in the PWM section of the data sheet.
Comment: Other than the frequency of the clock for channel x?
Answer: "fchannel_x_clock" is the frequency of the clock that you select when you program the PWM clock generator for that channel.
Take a look at section "38.6.1 - PWM Clock Generator" in that datasheet that you linked to.
Comment: Mark I dont think it is the frequency of the clock I have selected. The frequency of clock is 42MHz, and if I use this value to find the value of CDTY for a certain duty cycle I dont get a reasonable value for CDTY (the value comes out to be too large.)


Physics behind blowing soap bubbles

Question: Is it possible, using the surface tension of a soap bubble, to calculate the maximum pressure (created by the air flow) it can withstand while still attached to the orifice to prevent it from bursting? The idea behind being to estimate the maximum air velocity for a given orifice diameter.
Comment: If you blow a soap bubble the bubble is coloured due to an interference between reflections from its two surfaces.  Often just before the bubble burst all that colouration disappears.  This is due to the bubble becoming thinner and thinner eventually be so thin that only destructive interference occurs.

So the thickness of the soap film does not stay constant and it might be very difficult to answer your question in that you will probably need to know the original thickness of the soap film.
Another possible problem is that as the bubble gets bigger the pressure within it gets less.
Answer: Actually the physics of soap bubbles has been studied seriously very recently and published at PRL. You probably find your answer there.

Physics behind blowing soap bubbles


What does the numbers mean in this guitar tab if they already gave the chords to play?

Question: I understand E A D G B e
And the meaning of the letters above. Which I can play like the c chord and em . But I don't understand the numbers. Is it for the fret. Like where I should be playing on the fretboard because it doesn't make sense to me, if I'm going to be playing the C chord. The arrangement and finger placement is different.
Answer:
But I don't understand the numbers. Is it for the fret.

This kind of notation is called tablature, and essentially, yes - the number tells you which fret to play.

it doesn't make sense to me, if I'm going to be playing the C chord. The arrangement and finger placement is different.

There are many different ways to play each chord - there's not just one 'C chord', but dozens of different voicings and ways to arrange the notes rhythmically.
You can think of the chords at the top as a kind of 'summary' or 'rough guide' to what you will be playing, but the tablature (assuming it is accurate) shows you more precisely what to play.
Comment: Further to this, the chord names at the top enable someone on a different instrument (say, a keyboard or a ukulele) to play along, and would also help them improvise if necessary.
Answer: There are a few advantages of having both:

the tablature can tell you exactly what to play

the chords help if you want to transpose. With the tablature, it's easy to transpose up with a capo, but it's not too easy to transpose down when open strings (0 in the tablature) are used.

working on a specific tablature might help with a few similar songs, but working on a clean, fast transition between C and Em will help for thousands (millions?) of songs.

sometimes, only half a chord is played, and only the corresponding strings and frets are written on the tablature. But if you happen to play another string with the strumming hand, it might sound really bad and not fit at all. If you form the whole chord shape, it won't be a problem if you inadvertently play 3 strings instead of 2.
Answer: Tablature, or tab for short, is what those numbers are.  It's an extremely simple notation where each line is a string and the number is the fret to play on that string.  Tab generally doesn't including timing information line standard notation does but sometimes attempts to.
In cases like these including the chords above the tab is to

Help with the basic shapes of what you're playing.  Usually a chord chart will include the voicings of the chords they use at the top so you can get the fingering of each chord down.  Remember all it takes is 3 notes to make a chord, you can play those 3 notes in any one of hundreds of combinations on a guitar so you could play that C chord as an open position cowboy chord, a 3rd fret barre chord, triad form in any number of places.  Having the voicing tells you which one to use.  Having the tab can also imply which voicing to start with.
Help indicate the harmony.  If you just wanted to fake things for a party or invite your friend on some other instrument to jam with you.  You could easily reverse engineer the chords from the tab but it's easier if you don't have to.  Also having the harmony right there it becomes easier to transpose the song if you need to for a vocalist's range.

Including tab in addition to just chords also:

Helps indicate the strumming pattern and flourishes of the actual song.  A chord name above the bar is giving you the basic chord shape you're using but doesn't indicate how the player is supposed to strum that chord...fast, slow, on beat, hitting all the notes, or favoring the higher strings...lower strings.  Notice in the tab that you included there are also a lot of notes outside the chord shape being played to add interest to the part.  Like, open D isn't part of a C chord...but it's there in tab and if you don't play them it's not going to sound like the song you're trying to play but might sound like the mockbuster version of the song.  The tab also includes all the hammer-ons and pull-offs the player is supposed to do while changing chords to give the song flair and interest.  Just the chords puts a lot on you as a player to figure out exactly how to emulate the parts while the tab can give you those details.
Answer: Those numbers are indeed fret numbers. They tell which fret on the appropriate string/s to press and play.The chord names aren't necessarily reflecting what's played in each bar, but if you look at the 2nd bar, 2nd line, that's just what happens. Hold the whole chord down, and pluck accordingly.
The chord names show what fits each bar, and could be used by another guitarist, pianist, banjo player, etc, to accompany.The numbers here could also translate as to which fingers to use, especially if you play 'one finger per fret'.
The 'h', I guess is for the note to be hammered on, where the fretting finger hammers down on the appropriate fret.string, instead of being fretted and plucked.


Concentration dependence of electron transfer

Question: Regarding a single electron transfer:
$$O +e^- \rightarrow R$$
We find the current dependent on the overpotential as specified by the Butler Volmer equation:
$$i = i_0 (exp(\frac{\eta}{b})-exp(\frac{-\eta}{c}))$$
With $\eta =E^{applied}-E^{eq}$ the overpotential, $i_0$ the exchange current density, b and c Tafel slopes for the anodic and cathodic reaction. $E^{eq}$ is defined by the Nernst equation:
$$E^{eq}=E^0-\frac{RT}{F}ln(Q)$$
We find thus that the overpotential at the electrode surface is dependent on the concentration at the surface. The exchange current density itself however is said to be:
$$i_0 = Fk_0C_O^{\alpha}C_R^{\beta}$$
In some books, pages online, and review articles I've seen these thrown around so much that it is not clear anymore how the current density is affected by the concentration. If you rework the first equation with the Nernst equation one can get the Q out of the exponential, but is this already taken into account in the exchange current density factor or not? Is the current density "doubly" dependent on the concentration as in the overpotential is dependent on the current density and there is some dependence of the exchange current density?
Answer: Yes, the current density is "doubly" dependent on the concentration, in the following sense that you have written:

$ C_O(0,t) $ and $ C_R(0,t) $ appear in $E^{eq}$ within the overpotential defind as $ \eta = E - E^{eq} $ where $ E $ is the potential difference between the electrode surface and the bulk solution, i.e., $ E = \phi_M - \phi_S $.
$ C_O(0,t) $ and $ C_R(0,t) $ appear also in the exchange current density, which formally, has the following form

$$ j_0 = F k^\Theta \bigg(\dfrac{C_O(0,t)}{C_O^\Theta}\bigg)^{1 - \alpha} \bigg(\dfrac{C_R(0,t)}{C_R^\Theta}\bigg)^\alpha  $$
where $ \alpha $ is the symmetry factor, and $C_O^\Theta$ with $C_R^\Theta$ are the reference concentrations associated to the rate constant $ k^\Theta$.
You can see this "double" dependence in textbooks that derive B-V kinetics by using the Transition State Theory, or Eyring Theory, applied to charge transfer reactions.
Disclaimer: If you always talk about equilibrium, the concentrations at the electrode surface and the bulk are the same, so there is only one concentration to talk about. However, the kinetics are evaluated at the electrode surface, so it is a good practice to put $ (0,t) $, when it applies. When you write "$C_O$" or "$C_R$" in electrochemistry, my first question is, where is the $O$ and $R$ you are talking to me about? (my explanation does not take into account double-layer effects, where the evaluation is more subtle)
Comment: I do understand the need to specify it is the concentration at the electrode surface when talking about heterogeneous electron transfer. (In reality of course there is no specific point where charge transfer is taking place, it is spread out over space). Thank you for your answer, it cleared up some doubts I had. If only modern electrochemistry articles were better...


How to make user-uploaded photos all a uniform size

Question: I have a site where users upload photos taken from their digital cameras. I want the photos to appear as big as possible, almost take up the entire screen. I also want all the thumbnails, of various users, and blown up photos, to have a uniform size so the design works on my site and everything lays out properly. Is this possible, or am I going to be stuck with different sized pictures because some people turned the camera on it's side to take a picture and got a picture way taller than wider. Do the pictures need to be a certain file format, certain size, etc?
Answer: You can store the photos just as they're uploaded and resize them in CSS. This is really the best option for displaying full screen, because you don't know what size screen your users will have.
However, the obvious limitation is that if you change the aspect ratio the photos will look wrong. Your options for photos which are in a different aspect ratio are:

Add black bars to two sides to bring it into the correct ratio. This can be done with ImageMagick (libraries exist for PHP, Perl, probably Ruby and other languages) or in .Net it's a few lines with System.Drawing.
Crop it automatically. (Ditto).
Refuse to accept it and insist that the user crop it.
Give the user a JS interface to select their crop - as 3 but saving them the effort of finding some image editing software.
Do 1 but without changing the image by setting a width and height in CSS chosing by scaling with the aspect ratio constant until both dimensions are in bounds and then centring it on a black background.

In all cases, it's advisable to keep the original image around in case your layout changes.
Answer: IrfanView is a free desktop tool that you can use for batch resizing of images if you have a moderation process.


Why does the harmonic series diverge but the p-harmonic series converge

Question: I am struggling understanding intuitively why the harmonic series diverges but the p-harmonic series converges. I know there are methods and applications to prove convergence, but I am only having trouble understanding intuitively why it is. I know I must never trust my intuition, but this is hard for me to grasp. In both cases, the terms of the series are getting smaller, hence are approaching zero, but they both result in different answers.
$$\sum_{n=1}^{\infty}\frac{1}{n}=1+\frac{1}{2}+\frac{1}{3}+\frac{1}{4}+\cdots = \text{diverges}$$   $$\displaystyle \sum_{n=1}^{\infty}\frac{1}{n^2}=1+\frac{1}{2^2}+\frac{1}{3^2}+\frac{1}{4^2}+\cdots =\text{converges}$$
Comment: To make matters worse, $$\sum_{n=1}^\infty\frac{1}{n^{1+\epsilon}}$$ converges for all $\epsilon > 0$. That might make it a bit hard to "intuitively" grasp.
Comment: "Young man, in mathematics you don't understand things. You just get used to them."
― John von Neumann
Comment: I came looking for an answer trying to cope with this: http://en.wikipedia.org/wiki/Ant_on_a_rubber_rope
Comment: In addition to the answers here, it is possible that the answers to [this question](http://math.stackexchange.com/questions/29450/self-contained-proof-that-sum-limits-n-1-infty-frac1np-converges-for) can provide some insight.
Answer: Firstly, you should always use your intuition. If you find that your intuition was correct, then smile. If you find that your intuition was wrong, use the experience to fine-tune your intuition.
I hope I'm interpreting you question correctly - here goes. Since you are not interested in any of the proofs, I'll just focus on intuition. Now, let's consider a series of the from $\sum _n \frac{1}{n^p}$, with $p>0$ a parameter. Intuitively, the convergence or divergence of the series depends on how fast the general term $\frac{1}{n^p}$ tends to $0$. This is so because the sum is that of infinitely many positive quantities. If these quantities converge to $0$ too slow, the number of summands in each partial sum will be more dominant than the magnitude of the summands. However, if the quantities converge to $0$ fast enough, then in each partial sum the magnitude of the summands will be dominated by numbers of small magnitude, and thus outweigh the fact that there are lots of summands.
So, the question is how fast does $\frac{1}{n^p}$ converge to $0$. Let's look at some extreme values of $p$. If $p$ is very large, say $p=1000$, then $\frac{1}{n^p}$ becomes very small very fast (experiment with computing just a few values to see that). So, when $p$ is large, it seems the general term converges to $0$ very fast, and thus we'd expect the series to converge. However, if the value of $p$ is very small, say $p=\frac{1}{1000}$, then $\frac{1}{n^p}$ is actually pretty large for the first few possibilities for $n$, and while it does monotonically tend to $0$, it does so very slowly. So, we'd expect the series to diverge when $p$ is small.
Now, if $0<p<q$ then $\frac{1}{n^q}<\frac{1}{n^p}$, so the bigger the parameter the faster the convergence of the general term to $0$ gets. So, small values for the parameter imply diverge of the series, while large values of the parameter imply convergence of the series. So, somewhere in the middle there has to be a value $b$ for the parameter such that if $p<b$ then the series diverges, while if $p>b$ then the series converges.
So, just by this straightforward analysis of the behaviour with respect to varying the parameter $p$, we know (intuitively) that there must be some cut-off value for $p$ that is the gateway between convergence and divergence. What happens at the that gateway value for $p$ is unclear, and there is no compelling reason to suspect one behaviour of the series over another. Now, the particular whereabouts of that special gateway value for $p$ should depend strongly on the particularities of the general term. This is thus where you'll have to delve into more rigorous proofs.
I hope this rather lengthy answer addresses what you were wondering about. Basically, it says that a cutoff parameter must exist, but we can't expect to say anything about its whereabouts nor the behaviour at that cutoff value without careful study of the general terms.
Answer: We produce two series that are close in spirit to the series you mentioned. Perhaps the divergence of the first, and the convergence of the second, will be clearer.
Consider the series
$$\frac{1}{2}+\frac{1}{4}+\frac{1}{4}+\frac{1}{8}+\frac{1}{8}+\frac{1}{8}+\frac{1}{8}+\frac{1}{16}+\frac{1}{16}+\frac{1}{16}+\frac{1}{16}+\frac{1}{16}+\cdots.$$
So there is $1$ term equal to $\frac{1}{2}$, then a block of $2$ each equal to $\frac{1}{4}$, then a block of $4$ each equal to $\frac{1}{8}$, then a block of $8$ each equal to $\frac{1}{16}$, and so on forever. Each block has sum $\frac{1}{2}$, so if you add enough terms, your sum will be very big. But it will take an awful lot of terms to add up to $1000$, many more more terms than there are atoms in the universe.  Note that each term is less than the corresponding term in the harmonic series, so if you add together enough terms of the harmonic series, the sum will be very big.
Now consider the series
$$\frac{1}{1^2}+\frac{1}{2^2}+\frac{1}{2^2}+\frac{1}{4^2}+\frac{1}{4^2}+\frac{1}{4^2}+\frac{1}{4^2}+\frac{1}{8^2}+\frac{1}{8^2}+\frac{1}{8^2}+\frac{1}{8^2}+\frac{1}{8^2}+\cdots.$$
Each term is $\ge$ the corresponding term in the series $1+\frac{1}{2^2}+\frac{1}{3^2}+\frac{1}{4^2}+\frac{1}{5^2}+\cdots$.
Again, we find the sums of the blocks. The first block has sum $1$. The second has sum $\frac{1}{2}$. The third has sum $\frac{1}{4}$. The fourth has sum $\frac{1}{8}$, and so on forever. So if we add up "all" the terms, we get sum $1+\frac{1}{2}+\frac{1}{4}+\frac{1}{8}+\cdots$, a familiar series with sum $2$.
Comment: But it will take forever to actually get to two. You can keep adding it up - with more terms than there are atoms in the universe and still not actually be at two.
Answer: Intuitively the main argument why the harmonic series diverge is that $\forall k \sum_{n=k}^{n=2k}\frac{1}{n}>k\frac{1}{2k}=\frac{1}{2}$ since smallest element is $\frac{1}{2k}$ and there are k elements in the interval $[k;2k]$. So the harmonic sum for any finite interval $[k;2k]$ is > 0.5.
So if you split the infinite interval over which you make the summation into intervals $[1;k][k;2k][2k;4k],...,[2^nk;2^{n+1}k],...$ each interval has sum higher then 0.5 and since there are infinite number of this intervals to cover the whole $\mathbb{Z}$ it diverges.
Basically they get smaller and smaller, but not fast enough to converge to a limit.
The p-harmonic on the other hand because of the square in the denominator can not have this "ability" and converge, aka they get smaller faster enough.
To try to explain it on intuitive level better thing like this: you are adding infinite number of the sequence, so in order to converge to a limit L they have to get smaller with some "speed". Now even if they get close to 0 if the speed at which they grow smaller is not high enough then they still will be too much stuff added and will never converge.
Comment: I dont understand your first paragraph but your second paragraph is good. When you said it is not getting small fast enough that made a little sense to me. I still have issues though understanding, maybe I shouldn't think far past it then what it actually is and just accept that fact it is divergent. Thanks!
Comment: Tried to make the first one a bit more clear. It is basically demonstrating why the harmonics dont get smaller fast enough.
Comment: That inequality opened up my brain :)
Answer: If you convert the sum to an integral,
$$
\int_1^\infty \frac{1}{x^2} dx = -\frac{1}{x}|_1^\infty = -\frac{1}{\infty} + 1
$$
converges, but
$$
\int_1^\infty \frac{1}{x} dx = \ln x|_1^\infty = \ln \infty
$$
doesn't.
Comment: So, first understand intuitively whey $\int_1^\infty dx/x$ diverges but $\int_1^\infty dx/x^2$ converges.  Then it should not be so surprising that the same thing is true for series.
Comment: Yes, by the integral test it shows why it does converge and diverge but that isn't what I am having trouble understanding. I am having trouble understanding intuitively why it is.
Answer: Hmm, I like the answer of @Andre Nicolas much, so I would like to also generalize that idea to arbitrary real exponents p in the denominator.
First let's state, that a lower bound for any such series with real exponents p is 1 so let's write $L_p=1$.
Second let's restate the upper bounding series $U_2$ for exponent $p=2$ where the repeated terms are written as multiplications as given by Andre
$$ U_2 = 1 + 2\left(\frac{1}{2^2}\right) + 4\left(\frac{1}{4^2}\right) + 8\left(\frac{1}{8^2}\right) +...  $$
Now let's write this explicitely as powers of base 2:
$$ U_2 = 1 + 2^1\left(\frac{1}{2^2}\right) + 2^2\left(\frac{1}{2^{2 \cdot 2}}\right) + 2^3\left(\frac{1}{2^{3 \cdot 2}}\right) +...  $$
We see, how this generalizes to some exponent p:
$$ U_p = 1 + 2^1\left(\frac{1}{2^p}\right) + 2^2\left(\frac{1}{2^{2 \cdot p}}\right) + 2^3\left(\frac{1}{2^{3 \cdot p}}\right) +...  $$
Now let's collect/cancel the exponents
$$ U_p = 1 + 2^{1-p} + 2^{2(1-p)} + 2^{3(1-p)} +...  $$
But this is now a geometric series
$$ U_p =  { 1\over 1-2^{1-p} } $$
and this has a finite value for any $p=1+\epsilon$ and is infinite for $\epsilon=0$ or $p=1$
And if the upper bounding series has a positive finite value, and the lower bound is 1 then the series in question must be convergent with a value in between.
Answer: I think the best way to understand this intuitively is to look at the graphs of the representative functions, in particular, (1/x) and (1/x^2). You will see that the latter decreases much faster than the former, which means that it will reach 0, in a fantastical sense, "faster" than (1/x). Now, a series/sum can be thought of as a rough integral, so consider the area under each graph. As you go out to infinity, the area under the graph of (1/x^2) becomes much smaller much faster since, again, it is decreasing faster than (1/x). Therefore, less and less area is being added to the sum as you reach higher and higher values for n (the series substitute for x). However, with (1/x) it just so happens that the area under the graph of the function does not decrease as quickly. Rather, the area under the graph of the function is still significant enough to count towards the sum. Therefore, there must be some point on [1,2] where a split between converging and diverging occurs. And, though it may not seem so, (1/x^2) is an extreme case. Even much smaller values for p that are still greater than 1 converge. It just so happens that p=1 is the end of the field of numbers that allows this series to diverge, and everything greater than p=1 converges. In general, this is something that is accepted as mathematical truth.
Comment: welcome to MSE, the integral method is already explained in Slartybartfast's answer (in Latex)
Answer: Denoting $S_p:=\sum_{(n\geq1)}1/n^p$, and assuming we know $S_1=\infty$ the following "formal" manipulation explains why the series behave very differently:
$$
S_1-S_2
=
\sum\frac1n-\sum\frac1{n^2}
=
\sum\left(\frac1n-\frac1{n^2}\right)
=
\sum\frac{n-1}{n^2}
\geq
1+\sum_{n\geq2}\frac{n/2}{n^2}
=
1+\frac{S_1}2-\frac12
=
\frac12\left(S_1-1\right)
=
\frac12(\infty-1)
=
\infty.$$
This doesn't explain why $S_2<\infty$ but (one is left hoping it may be and) one should not to be too surprised if the answers were very different since their difference is infinite!
To "see" why $S_2<\infty$ and $S_1=\infty$ consider the "harmonic warehouse" problem where the warehouse worker must store infinite boxes with square bases of side $1/k$, for $k=1,2,3,\dotsc$. Looking from above at the warehouse, a $2\times1$ rectangle, subdivide it, starting from the west and moving eastwards into rectangular storage units of size $U_0:=1\times1$, $U_1:=1/2\times1$, $U_2:=1/4\times1$, etc. Each unit $U_l:=1/2^l\times1$ is then subdivided into $2^l$ subunits of size $1/2^l\times1/2^l$, now place the box of base $1/k\times1/k$ for $k=1,2,3,\dotsc$ in the first available subunit with $l=\operatorname{floor}(\log_2k)$ filling each unit from south to north.
You will obtain the following picture where the subunits are in light blue, the box bases are in middle blue and the sides are in dark blue. $S_2$ is the sum of box base areas, $S_1$ is the total of the dark sides, which for each unit $U_l$ cover a length larger than $1/2$ because the side of each box is larger than half its subunit's side.

It is now visually evident that $S_2<2$ while $S_1\geq1+1/2+1/2+\dotsb=\infty$.


Suitable neural network type to classify text in images

Question: I have images that contain text and I am not sure what is the type of NN that can do the job for me. Basically, it will have to read the images and understand the text in order to be able to classify it. I am not sure if CNN is suitable in this case?
Answer: I would recommend using pretrained text extractors, like amazon textract or tesseract, and then train a network on the extracted text. The solution is going to be simpler and the learning is going to be easier for the NN.
Comment: Actually I have also the original text (I convert it to image). I was just wondering if cnn are able to work on the text inside the images. Working with the text "as it is" is not helpful in my case
Comment: Yeah they can, and fully-connected networks can too,  but why would you do that? I think Jeremy Howard from fast.ai mentions that in most cases is better for the network to be trained on two steps that end2end. I don't understand why working with text as is is not helpful in your case
Comment: So the answer is, CNN are not suitable, but nobody will prevent you from doing it
Comment: I think there are preprocessing steps that are better than converting to an image
Comment: Ok, thanks for your help


Wi-Fi search does not occur Debian 11

Question: I'm new to working with Linux, before that I had onу Linux Mint.
I installed Debian 11 from a bootable USB stick. I tried to install from the netinst version of iso, but I could not connect to the hidden network, so I installed the main system without a graphical shell.
After that, I decided to install from the image of the base system (4.7GB) with the GNOME shell. The installer required an ap for the network card, I added this file to iso and booted the system without access to the Internet.
I expected to be able to connect to the hidden network without problems, but in the system settings under Wi-Fi there was an inscription "Missing firmware".

My network card is Realtek.
And USB Wi-Fi Modem.

I downloaded a lot of non-free deb packages to a USB flash drive - realtek-firmware, Linux-firmware-non-free, but nothing changed.
I noticed that when the system starts, when the components are loaded, the last gray inscription says the absence of rt28070.bin. I found it and uploaded it to the /etc/firmware folder.
After that, the inscription "Missing firmware" disappeared. But no network was detected, it also did not work to connect directly.
Please tell me how to fix this error?
Answer: The solution was found. I needed to delete rt2870.bin, and put the package firmware-misc-nonfree!

Wi-Fi search does not occur Debian 11


Does skunk off flavour go away?

Question: Skunky off-flavours are caused by ultraviolet light causing chemical reaction that transforms alpha-acids. Once this flavour is created, does it go away with time, and if so how much time? Or will it stay forever once it is present?
Answer: No, it doesn't go away - the photochemical reaction produces compounds that do not degrade  quickly and are not broken down by the yeast.
Professor Beer writes:

When light hits beer, it provides the energy necessary to drive a
  reaction that transforms the iso-alpha-acids into
  3-methyl-2-butene-1-thiol. The "thiol" part of that somewhat
  cumbersome name indicates that there is sulfur present. Sulfur
  compounds often have strong, offensive aromas. Some musteline animals,
  like skunks, have evolved the ability to produce this chemical, and
  use it for self-defense.

The reaction proceeds quickly with clear or blue glass:

[...] a
  well-hopped beer in clear glass can become noticeably offensive with
  just 30 seconds of exposure to sunshine. Brown glass transmits less
  visible light than the previously mentioned colors, and therefore
  offers some protection from skunking. It does allow some light
  through, so beer in brown bottles will skunk after a few hours of
  light exposure.

The thiol compound doesn't break down spontaneously, so in unadulterated beer, the reaction is irreversible, and detection levels in humans is less than 1 billionth of a gram in a 12oz beer bottle, so it doesn't take much exposure to light to noticeably skunk the beer.
The skunk compound is normally insoluble in water, but can be made soluble by adding hydrogen peroxide, baking soda and soap, which is often used as a remedy to wash away shunk spray - and tested on Mythbusters! But of course this can't be done for the skunkiness in beer.
The best course of action is to simply keep the beer covered and out of sunlight
Comment: green bottles are very bad too. That is why Heinekin is so often skunked.
Comment: yes, while green does offer better protection than blue or white, they do let in some UV radiation and will skunk the beer over a course of a few hours.
Answer: My experience is that it does not go away.

Does skunk off flavour go away?


Cuckoo hashing proof of cycle

Question: If we come to the situation when we have to insert again the original key into the original table, I believe we have found a cycle. Is there a way to prove this?
Answer: Yes there is, using algorithms such as Brent's cycle finding algorithm.
However, this is quite expensive and has fairly complicated code. What most implementations do is define some constant cycle/chain length, for example $\log n$ where $n$ is the number of elements in the hash table. If you find a chain (or cycle, but we never investigate whether it's actually a long chain or a cycle) larger than that constant we rehash or increase the hash table size.
But if your goal is merely the prove that you have a cycle, and you do not care about efficiency, the simplest method is to invoke the pigeonhole principle, and just loop $n + 1$ times where $n$ is the number of possible slots in the hash table. If you never find an empty slot you must have a cycle.
Comment: Therefore just to be sure, if we insert key A into table 1 of Cuckoo table H at time t1. If we come again to the state of having to insert key A again into table 1 of Cuckoo table H, the position of Cuckoo table H now is the same as it was at time t1.
Comment: Actually, returning to the same key is not sufficient to demonstrate a cycle. It's a cycle the third time you see the key.
Answer: No, a repetition is not sufficient to demonstrate that there is a cycle.
If a key needs to be inserted into a cuckoo hash table, and it cannot be directly inserted (i.e. neither of the two hashes produces an empty nest), then there are two possible elements which could be evicted. The algorithm selects one of these two elements, and proceeds to do the eviction chain. After the first eviction, at each step there is only one possible choice, which is the "other hash". It's possible that this will lead back to the original element leading it to be evicted; this time, the other hash will be selected, so the next steps will not be the same as the cycle.
So a cycle results only if the same element is encountered twice during the eviction.
One useful way of looking at this is to consider the "cuckoo graph": a graph whose nodes are hash table positions (hash values) and whose edges are keys in the hash table. Each edge connects the two possible hash values for the key. A new key can be added provided that the SCC containing the new edge contains at most one cycle.
There is a good explanation of the cuckoo graph with a great animated graphic on Adrian Neumann's page on cuckoo hashing.
In fact, it is quite common for a key to repeat once during the cuckoo algorithm, so the using an unmodified cycle detection algorithm will result in too many rehashes, making the expected insertion time larger than $O(1)$. Instead of using a more complicated cycle detector, the usual approach is to simply cut off the eviction chain after it gets to some length. Since the probability that a chain reaches length $k$ is exponential in $k$, there is a threshold in $O(log N)$ (where $N$ is the size of the table) where the probability of a false positive is sufficiently low that the insertion time is still $O(1)$.

Cuckoo hashing proof of cycle


jQuery: keyup event for mobile device

Question: I'm having a few issues getting a keyup event to fire on my iPhone, my code is as follows:
        var passwordArray = ["word", "test", "hello", "another", "here"];

        var test = document.getElementById('enter-password');
        test.addEventListener('keyup', function(e) {

            if (jQuery.inArray(this.value, passwordArray) != -1) {
                alert("THIS IS WORKING");
            } else {}

        });

The idea being that as the user is typing into the #enter-password field, as and when they've matched a word in the passwordArray the alert will fire. This works on desktop, e.g. once you've entered word the function will fire straight away as soon as you've typed the d. Is there anyway to get this to work for mobile too?
Answer: You can add input event. It is an event that triggers whenever the input changes. Input works both on desktop as well as mobile phones
test.on('keyup input', function(){
  //code
});

You can check this answer for more details on jQuery Input Event
Answer: There are three events you can use (but you have to be careful on how you "combine" them):

keyup : it works on devices with a keyboard, it's triggered when you release a key (any key, even keys that don't show anything on the screen, like ALT or CTRL);
touchend: it works on touchscreen devices, it's triggered when you remove your finger/pen from the display;
input: it's triggered when you press a key "and the input changes" (if you press keys like ALT or CTRL this event is not fired).

The input event works on keyboard devices and with touchscreen devices, it's important to point this out because in the accepted answer the example is correct but approximative:
test.on('keyup input', function(){
}

On keyboard based devices, this function is called twice because both the events keyup and input will be fired.
The correct answer should be:
test.on('keyup touchend', function(){
}

(the function is called on keyup for desktops/laptops OR on touchend for mobiles)
or you can just simply use
test.on('input', function(){
}

but remember that the input event will not be triggered by all keys (CTRL, ALT & co. will not fire the event).
Answer: The touchend event is fired when a touch point is removed from the device.
https://developer.mozilla.org/en-US/docs/Web/Events/touchend
You can pass keyup and touchend events into the .on() jQuery method (instead of the keyup() method) to trigger your code on both of these events.
test.on('keyup touchend', function(){
//code
});

Answer: You should add a input event. It works on both mobile and computer devices.
Comment: It would be good to add more information to your  response. See [the FAQ](https://stackoverflow.com/help/how-to-answer) and try to update your answer

jQuery: keyup event for mobile device


Could IOT Botnets be Stopped by Static IP addressing the Devices?

Question: I followed the recent IOT DDOS against Dyn and noticed that the attack seemed have three rounds of attack and mitigation. Since I'm not well versed in infosec I did some reasearch around DDOS mitigation techniques. From what I could tell it seems mitigation is essential heuristic traffic analysis to filter out humans from bots then IP banning.  Separately, I also noticed that in almost all the media had the same conclusion that IOT devices are insecure and can't/won't be patched for years. If these two assumptions are true, DDOS mitigation in its rawest since is IP filtering, and we are stuck with millions of infected IOT devices (and adding millions more devices that will one day likely be infected), wouldn't it make sense to start giving IOT devices a static IP, and then when it's detected as participating in a DDOS share the IP to others and block it?
Comment: we are talking about hacked devices. are you sure you can enforce static ip's?
Comment: What if the ip a company just blocked is some consumer's that just got hacked? Or worse, they weren't in a botnet and simply happened to be in the wrong place at the wrong time. A better thing to do would be to assign a human being to every IP as well and when the ip has a problem, contact the owner and tell them they have an infected device.
Comment: That would mean the end of open WiFi.
Answer: Almost all IoT devices of the sort we are talking here (ie, consumer level) are deployed behind home grade routers (or ARE home grade routers) and are using IPv4 and NAT/uPNP to reach the internet.  That means they are sharing an IP with legitimate traffic for one and for another are using a dynamic IP, not a static IP, meaning there's even more opportunities for innocent parties to be caught up in such a blacklist.
Once the glorious world of IPv6 comes, we can likely do just that - assign each one a routable IP address and blacklist them as they get shown to be vulnerable.
One legitimate thing that CAN be done is for ISPs to perform source IP filtering - that is, don't let spoofed packets out, only let packets from IPs within the network.  That will help. Some.
Comment: I once heard a joke about IPv6 in the university, I can't recall it fully, but it ends with `"Fine, I'll just use my lightbulb's [IPv6] address instead."` @Shackledtodesk =) - heck, even iphone's IMEI are being spoofed now.
Comment: (+1) If ISPs implemented NIF (https://tools.ietf.org/html/bcp38), that would help.  Although, I'm not sure whether playing wack-a-mole with IPv6 is really feasible unless you are considering "hard coding" IPs into devices like MAC addresses.  Otherwise, you are back to, get your IP blocked, get new one, and be back in business.
Comment: @Shackledtodesk I have to agree - I just think at least being able to uniquely, if only temporarily, ID the actual devices has to be a step forward.
Comment: @Shackledtodesk are we assuming that IPv6 hard-coded addresses won't be spoofed the way MAC are right now?
Comment: @Mindwin, you make a perfectly valid point about spoofing.
Comment: IPv6 won't help. The global part can still be dynamic, and likely will be for consumer internet access. The local part can often be influenced by the device, so it's completely worthless for blacklisting.
Answer:
wouldn't it make since to start giving IOT devices a static IP

No, because IPs only work in the proper network context.
An device's IP needs to be routable, which is to say, sitting on a network with routers that know how to communicate with other networks and are willing to do so on behalf of the device.
First of all, if you hardwire IPs and send them out, you'd have to use RFC1918 IPs (non-routable) to avoid conflicting with IPs owned by other people.  So you're already stuck with a narrow slice of addresses you can use.  And those IPs would need to be translated when they hit the Internet, thus removing the ability of the target to filter on them.
Second of all, you'd be handing people devices with IPs that may or may not match their networks.  They wouldn't want to rework their networks to accommodate your cheap IOT devices.
In short, a device's IP is set to allow it to work on the network.  Setting the IP and expecting the network to work with it breaks things.
Answer: The way IP addressing is done for IOT devices doesn't matter in a DDOS attack. Here is the reason why.

IOT devices may not always be exposed to network with an external IP address.
It can also be device behind a NAT which has only an internal IP
address.
So irrespective of whether it is DHCP or some static IP, provided by  the router to the device, from the DDOS attack victim's
perspective, the source of the attack is the external IP of the
router.
In other words, if you have an IP cam at home, The packets from your IP cam as well as your laptop will have the same source IP address, ie the public IP address of your router.
So filtering the packets based on source IP of the packet can deny service for your laptop as well.
Answer: No, as dynamic addressing isn't the attack vector when IoT devices get abused. It's poorly written software! On the DoS side, we have the 'underpowered' device vs. powerful computer problem, and on the connectivity side we have the ease of use vs. security problem.
Ironically, the only way to do proper IoT is to not connect them to the internet! At least a gateway plus locally configured outgoing tunnel would be needed before they can be connected at some sort of safe level.
Answer: A static IP would not help; as crovers mentions, due to ipv4 exhaustion, its just not practical. Although IPV6 provides a large enough address space for each device to have a staic IP address, there will still be a lit of overlap with the IPV4 world - where a server will just see lots of traffic arising from a point of presence for IPV6 nodes.
But there are a lot of things manufacturers and governments can do (to make up for the lack of skills on the part of the buying public). Blocking traffic ther than from/to the local network on an appliance by default, forcing a change of admin password before the device, using encryption appropriately, supporting open standards.
The goverment part is more tricky - the obvious solution isproviding an accreditation framework which is easily auditable but minimally invasive with minimum standards, the problem is that they tend to listen to either the "experts" advocating (for example) that all such devices should be fips-140 certified or the vendors bleating about customer freedom and over-regulation rather than seeking pragmatic solutions.
Maybe someone might set up an IETF to look at the classification problem.


Reporting Error.The Report cannot be displayed(rsProcessingaborted) in CRM 2011

Question: I created one SSRS Report and then I deployed it on CRM.Now when I Open it i Got an Error like Reporting Error.The Report cannot be displayed(rsProcessingaborted)...I have checked that Report working well but the issue comes after when i Deployed it on CRM...Please help me
Answer: I have run into several different problems deploying reports to CRM.  The first one I hit was trying to use a "shared connection".  CRM wants to replace your connection information when you upload the report, but it doesn't seem to be able to if the report is setup as a Shared Connection.
Take a look at my SSRS troublshooting steps and see if they help.  You should be able to report back a more detailed error message.


does KVM has the same tool like vmware tools?

Question: VMWARE has vmtools to enhance VM performance. Does KVM has the same tool to enhance its VM?
If so, how to install such tools? thanks for any input!
Answer: Yes, vmware tools provide paravirtualization support to the guest operating system. The equivalent for KVM is virtio. Drivers are available for linux and windows:
http://www.linux-kvm.org/page/Virtio
Answer: There is no such thing at the moment.
Comment: ok...is the performance actually the same? I mean KVM meets this requirement through a different way from vmware tools?
Answer: One of the big advantage of VMware is the comprehensive operation and maintenance applications (GUI-based). That's definitely a value-add of VMware tools but at high price (licenses).
Ubuntu w/ KVM seems to have better performance compared to VMware. The challenge here is more related to manageability. Command line provides as well a lot of possibilities but the VMware GUI's are more human readable.
Of course, it depends about the use case and the experience of your administrator but in a service provider environment, manageability is key of success.


What is academic degree after PhD?

Question: Does your country have any academic degrees after the PhD? If yes, what is it called and how graduating this degree?
Additionally, what is a Post-Doc? Is it a degree or something else? I have seen some people refer to a post-doc in their CV as they would a degree. Is this acceptable?
Comment: I'm closing your main question as it's a duplicate of a previous one. As for your question concerning what is a postdoc, you can have a look at: http://academia.stackexchange.com/q/2173/102
Answer: In general, a PhD is the highest degree you can get. A postdoc is simply a research position that is not permanent, i.e. no fixed contract or tenure. There are some exceptions, for example in the German system where you can get your Habilitation, which is a degree after you get your PhD. But in most systems there is nothing beyond a PhD in terms of degrees.
Comment: Thanks for your answer. In our home country we have it. In Mongolia is so called Doctor of Science (ScD). PhD and ScD is very different degree by our rule.
Answer: Many countries have higher degrees than the PhD.
In the UK, there's

Litt.D Doctor of Letters / Literature
DSc Doctor of Science
LL.d Doctor of Laws
D.D. Doctor of Divinity

Each of these typically requires the submission of a body of work - a research portfolio - together with a critique of the work. Or they may be awarded as honorary degrees; see the links above for the requirements for the degrees from the University of East Anglia (Litt.D, DSc, LL.d), and the University of Oxford (D.D.), accordingly.
A post-doc is just an academic research job that's typically done after attaining a PhD. It's not a degree in its own right
Comment: Thanks for answer. It was interesting to read about different Doctor degrees in different country.
Answer: As @Paul Hiemstra pointed out, the highest degree level is a Doctorate (Dr) however, with this in mind, there are different academic titles that you can gain if you work at a University or high-educational institute. Here are a few:

Senior Lecturer (Usually appointed to a academic with a level of experience, this is usually how many years they have been at a University).

Master Lecturer (This is usually a rank about a Senior Lecturer)
Reader (This is someone who usually has a vast amount of knowledge and a strong academic background who is employed by the University not so much to lecturer, but, to carry out research for the university).
Professor (I believe this title is different in the US but this title is given to an academic who has an outstanding background in research and has published books, received a lot of funding for the particular University.) A Professorship is not something that can be studied for, it is something that is achieved and you are selected for by a special panel.

You can find more about titles here
Comment: This doesn't answer the quesstion. It's also restricted to the UK; other countries use different terms and/or use some of these terms in different ways. It also seems to be based on a misunderstanding: you say that a reader is employed "not so much to lecture"  but even lecturers spend the majority of their time on research at the older, research-based universities. I've never heard of a "master lecturer".
Comment: Thanks for very detailed answer. I am agree with you that Professor is academic person who have own space in any kind of science research field.

What is academic degree after PhD?


How can we obfuscate or hide our Struts2 web application code when it is hosted with another company?

Question: I have a web application written in the Struts2 framework.  I want to host the application with another company.  Is there any way to hide the code which is hosted on the server?  What I want is to hide the code from anyone who has access to the server.  Using the application would be allowed, but viewing the code prohibited.
Comment: What kind of web application do you speak of? What language is that web application written in?
Comment: well, can you tell us at least about your environment: *Nix, windows, asp.net php or ??
Comment: You haven't given us *any* specifics - things to include might be the server OS, web-server software, programming language, and the area of your application you're trying to secure. Please read the FAQ: http://stackoverflow.com/faq
Comment: A disturbingly bad question... Which code? The client visible code (so, generated HTML) or server-side code (JSP)? What do you mean by "access to the server" - like a user that has an account with filesystem access, or just someone with a web browser?
Comment: This is not a programming question.  I know struts2 but this has nothing to do with struts2/java, you are putting content on someone else's machine if they really wanted to get at that content they can get a copy. It's like saying "I want to put my money in a bank, what assurance can I have that they will not steal it?" For which the obvious answer is they can, but how would that make any sense?
Comment: Then again if you meant source code... simple, don't put the source code on the server only the war/ear.
Answer: If you want to protect you HTML and javascript code then there are tools like Googles Closure compiler that optomise the javascript and in the process render it difficult to reverse engineer.
If your code is written in java then there are open source tools like Proguard. It is likely there are similar tools for other languages. Retrofitting obfuscation can be a be a bit tricky, especially where interfaces are concerned but does provide a degree pf protection.
Answer: By hiding code i assume that you want to restrict others from seeing your business logic which includes you struts2 Action classes any other configurations and Business logic or other potential algorithms business routines you have written in your application.
When we deploy our application on a web-server we generally give only class files along with any JSP,CSS java-script etc.
though there is no certain or 100% way to d-compile java classes but there are potential so many d-compiler out there which can help to d-compile the code.
So if some one want to really see your code he can get an idea about it.
regarding securing JSP/HTML/CSS etc <code>@pauli</code> has already mentioned some ways but still there is no way you can assure yourself 100% about this.
Comment: How can I migrate a question?
[question is](http://stackoverflow.com/q/8237005/1041341)
Comment: I have been facing ban because of this question.. How can I remove my ban??? I cant ask any questions..
Comment: what kind of ban??
Comment: For this question I have got -2 reputation..
Comment: Previously in some questions I gave a site address directly for reference, which I got as tutorial from apache struts site.. Some1 flaged it and moderators deleted them... From that time onwards I cant ask questions
Comment: Now the ban  s removed
Comment: good enjoy and just careful not to use any stuff which you also feel can be flaged :)


Analyze Isaiah 14:18-19.

Question: What is the new thing God is doing in Isaiah 14:18-19?
And what is the historical background of this idea?  Did it develop out of another Jewish concept?
Comment: Please add to your post the actual text to which you are referring from a widely used translation and/or the manuscript (I assume masoretic Hebrew) text. Please indicate to what particular idea you are referring.
Comment: Welcome to Biblical Hermeneutics Stack Exchange J. Hawk, thanks for contributing! Be sure to take our [site tour](http://hermeneutics.stackexchange.com/tour) to learn more about us. [We're a little different from other sites.](http://meta.hermeneutics.stackexchange.com/a/803/423)
Answer: Although critical scholars attribute Isaiah chapters 1-39 generally to Isaiah, son of Amoz, writing around the beginning of the late monarchy, the consensus is that the passages from Isaiah 13:1 to 14:23 were written much later, as they concern Babylon during the period of the Babylonian Exile.
The king of Babylon, who had hoped to live among the stars in his after life (14:12-15) has been defeated. Exultantly, the author says that all the  kings of other nations lie in glory, but that the hated king of Babylon will have no such burial (14:18-20).
R. Mark Shipp(Of Dead Kings and Dirges: Myth and Meaning in Isaiah 14:4b-21, page 137) describes the passage as a dirge and analyses its poetic structure.
Answer: The bloody destruction of spiritual & literal babylon & God will be merciful to Jacob & overturn their captivity back,Israel will possess the gates of their enemies once more (genesis 24:60)NKJV what was meant for evil God will turn to good (psalms 21:11)NKJV the Lord will give them rest from all their enemies around.The Babylonian king will not be given an honourable burial deemed important for monarchs,the corpse of the Babylonian king will be thrown out like a rejected branch what a contrast to the branch of the stump of jesse which will bear abundant fruit (isaiah 11)

Analyze Isaiah 14:18-19.


how to call a c# webservice from java

Question: Is there a way to call a c# webservice from java? I have a webservice which was written in c# language and I do want use this webservice in java. If there is a way, please let me know.
Regards
Altaico
Answer: A webservice is just a little program that generates some text, which is then sent by HTTP.
The text could by Html or Xml (or plain text).  The language that little program is written in is completely irrelevant, since all your Java client will be seeing in text delivered by Http.
Call it exactly as you would call a webservice written in Java or any other language.
Answer: Web services is a standard protocol.  You can call a C# web service the same way you call a Java web service.  You can generate a client from the WSDL definition file provided by the service.
From a C# (.NET) web service you can get the WSDL definition file in the following URL:
http://[web_service_virtual_path].asmx?WSDL

Answer: I have done this a number of times. Web service support is included in java 1.6 as standard so there are no additional jar files needed.
The starting point is the WSDL url. This looks like a standard HTTP URL with a ?wsdl on the end. As noted by @Germán in his answer it will look something like this:
http://[web_service_virtual_path].asmx?WSDL

The next step is to run wsimport. wsimport is part of the Java 1.6 distribution so no additional downloads are necessary.
I have used the following command from the command line to generate the Java client side code based on the wsdl:
wsimport -s src -keep -Xnocompile http://[web_service_virtual_path].asmx?WSDL

This will create a java package tree in the src folder and leave the .java files there.
(There may be additional flags that need to be set depending on how the actual web service was created or for example you are hiding behind a proxy server. Run wsimport with no parameters to get a list of these flags or options)
The web service documentation (even if it is in C# format) will usually be enough for you to continue writing from this point. This documentation should be available from the writers of the actual web service you are trying to connect to.
Answer: The language the webservice is written in should be irrelevant -- that's part of the point of using web services.  In general, yes, you can call webservices from Java.  One library that can help you with this is Apache Axis.

how to call a c# webservice from java


How to get current (foreground) activity name?

Question: Hoi! I'm trying to make an automatic night mode for my phone using "Automate", but I can't find certain app activities. How do I get to know what activities are executed in the foreground at the moment, so I can start it?
Comment: Legit question, but you probably want to edit to make sure it doesn't appear off-topic. (lemme do that for you this time, hope I understood it right) // Unrelated: that "hoi" sounds a lot like Temmie.
Comment: Forgot to add: feel free to edit on top or even perform a rollback if I put it wrong - it's your post after all.
Answer: Using apps: Current Activity and some similar apps will display the info in the form of floating texts above the screen content.
Using adb (from your PC): dumpsys window windows | grep -E 'mCurrentFocus', or dumpsys activity top (for full info meant for developers)
Comment: Note: it's `adb shell ...`
Answer: To add to @AndyYan's answer, you can also use a terminal emulator app, if you don't have a computer but have root privileges. In this case, execute su first. Then, to dump the focused activity, the command is
dumpsys activity activities | grep mFocusedActivity

The command, if e.g. executed from Terminal Emulator, gives the following output:
  mFocusedActivity: ActivityRecord{415c7ae u0 jackpal.androidterm/.Term t96}

The command above, as Andy pointed out, merely shows the Terminal's own activity, though. In order to give yourself enough time to open the app you wish to investigate, though, you need to prepend
sleep <seconds> &&

before the actual dumpsyscommand, replacing <seconds> with the number of seconds you want the shell to wait. An example of complete command, thus, will resemble
sleep 10 && dumpsys activity activities | grep mFocusedActivity

After executing the command, open the app you wish to investigate, and keep it in foreground for the number of seconds you specified. Once the time has elapsed, the shell will report the activity's name.

I'm not affiliated to the abovementioned app.
Comment: @AndyYan Who said they can't? It's just a matter of adding `sleep x && ` before `dumpsys` (x must be replaced by how many seconds the terminal may wait), so that one can open the app they need to investigate, and let the terminal handle the rest. I'll add this to the answer later.
Comment: (facepalm) Obviously I'm no terminal guru...
Comment: @AndyYan Me neither. iBug's the one.


What does "subsonic Fluger impact delivery dart" mean?

Question: It's from "The Lost World. Jurassic Park". The character of Richard Schiff describes his rifle. "Lindstradt air rifle. Fires a subsonic Fluger impact delivery dart".
This line drives me crazy. Especially "fluger" or "fluger-impact". I couldn't find any definition in the Internet. I think it's a name, but even though it doesn't make any sense to me.
Comment: Fluger is a proper name, presumably the inventor or manufacturer of the type of dart. The dart is propelled by a burst of air and flies at less than the speed of sound; upon impact with its target, it delivers a dose of fast-acting poison, IIRC.
Answer: It doesn't mean anything.
Notice that "Fluger" has a capital, indicating it is proper noun. It probably refers to the fictional company that makes the darts.
To give a sense of realism, the author drops these little details in. It gives an impression that his characters have depth. He is showing that Schiff is an expert in guns and darts, since he knows the brand of darts that he is using. It is part of the character development that the author is doing.
Here is the quote in context, and a wiki page about the gun


Fifth-Up Progression

Question: If you have a song that is a Fifth-Up Progression like Jimi Hendrix Hey Joe where there is a chord progression of c g d a e. Why is it that you can use em for soloing and what other modulation and scales go with the chords of the progression?
Comment: suggested title edit: why does a minor pentatonic scale work over a chord sequence by descending fourth?
Comment: https://www.youtube.com/watch?v=DVvmALPu5TU
Answer: I really don't understand why you have had so much trouble asking this question on this forum yesterday! It seems like a good question and gets into something that I think is particular to rock style.
Full disclosure: while I know the song, I never played it until yesterday and I had to fake it really badly.
But I was trying to understand the how and why and this is what I came up with:
First we have to make an important point about blues and rock tonality: a minor third added to a major chord is dissonant in traditional harmony terms, but very much in style for blues and rock. In fact, you could say it is definitive of the tonal style in blues and rock. For example, a G natural can be added to a E major chord which contains a G#. Voicing is important. It's typical to have the minor third, the G natural, in a high register in melodic passages.
Next, let's point out the chord do no get equal duration. C G D A go over 8 beats and then E alone gets 8 beats. Right from there we see E gets more time and that reinforces E as a stable goal, as the tonic.
Put these first two points together and we can see that 50% of the performance time is presenting a fundamental blues tonality. Half the time it's just straight forward blues.
What remains is a way to understand the portion that is C G D A.
The G chord is easily "explained." The relative minor of E minor pentatonic is G major pentatonic. It's the same set of tones just starting on G instead of E. Shift emphasis away from E and A in the scale and it's all chord tones matching the G chord.
When comparing the remaining chords C D A with E minor pentatonic we see there is a fair amount of "agreement" between the chords and scale depending on how you look at it. Basically the scale provides two chord tones for each of those chords and all the other non-chord tones are sensible in terms of related keys.
Just to flesh that idea out a bit, imagine a lick alternating between E and G. Both tones in it will match the C and G chords. If we allow for the A to take the form of a dominant seventh, then E G matches that too. Image a lick alternating E and D. Treating one as the neighbor tone of the other it will match any of the five chords in the whole progression.
That point is worth repeating. Licks focusing on E and D will match any of the chords simply by shifting between one or the other as the chord tone.
But all this chord tone matching seems artificial. I don't think anyone thinks about that when they play in this style.
The thing that makes it "click "for me is to just play an E on top of each chord. I did it strumming this:

C x32010
G 35x45x
D xx0230
A x02220
E 022100

...when I did that I thought "oh, yeah, that's the basic sound of the song."
Technically, when you hold a tone over a series of chord changes it's called a pedal. In this case the pedal E is the ostensible tonic, so it's called a tonic pedal. The important thing with a pedal is the deliberate clashing of tones as the chords move away from the pedal.
We can forget all the fussiness of trying to match chord tones to the E minor pentatonic. The tonic is E, the guitar solo remains firmly in E minor pentatonic, and when the chords move through C G D A it's a source of dynamic tension under the soloist driving to and reinforcing the E tonic.
You could also break it up into two segments. C is a tension resolving to G and G matches the scale, then secondly D A is a tension resolving to E matching the scale.
Either way the point is: to the extent that the C, D, and A chord seem to not match the scale, it is not a problem. It is a dynamic force in the music. During the solo E minor pentatonic is the foundation. The chords dynamically support that tonic.
If you don't mind mixing music theory with your rock, you might want to read this:

Temperly, The melodic-harmonic 'divorce' in rock.
Answer: The fifths-up bass movement doesn't have anything to do with the suitability of the pentatonic scale per se. Even if there are many chords, there are two main keys. The progression is sliding between G major (E minor) and E major keys and letting you wander somewhere in between, and E minor pentatonic notes just happen to do something sensible in both G major and E major. Layering E minor pentatonic or E minor blues over E major is a common bluesy trick. Play X minor pentatonic scale over X major key. Flirt with major/minor mode changes.
Exactly when does the key change? All the time? Never? It's up to you to decide. Here are a few possible ways to interpret and handle the harmony:

If we remove all of the harmonic ambiguity and "guess what the key is" tricks from blues and jazz, the song might become something like this:

The Hey Joe progression has been talked about in this question Chord progression if the chords are not part of the scale?
The accepted answer analyses it as a series of I - V motions and key changes along the circle of fifths, but to me that feels like a far-fetched solution. To my ear, the most natural way to hear the chords is IV - I - V - II in the key of G, and then the E major - and perhaps the preceding A major is the only real "surprise" with a touch of key change feeling, because E minor was expected there. Removing those mode change feelings it becomes:

    C G D Am Em

But it's just been jazzed up a bit by changing the Am and Em to majors. As the OP noticed, you can play E minor pentatonic over the entire progression, and it kind of glues it with a feeling of being in Em all the time.

Fifth-Up Progression


my contacts lost

Question: I moved all contacts to the sim, on Android.
now there are no notes or contact photos.
no backup exists
I moved them back to the phone and still not exist, what can I do to retrieve them?
Comment: If there's no backup (e.g. synced to Google Contacts or other providers), then I'm afraid it might be not easily recoverable since SIM contacts are very basic and mostly only store name and phone number...
Answer: Usually an address book entry on a SIM card consists of only two fields:

Telephone number
Name

All other fields you had used before moving the contacts to the SIM card are unsupported and therefore got lost when you chose to move them to the SIM cards.
Moving them back to the Android/Google address book does not recover the additional fields as the SIM card does not contain this data.
The only way to recover deleted contact is if you had synced the contact to your Google account.
Google Contacts allow to recover deleted contact, e.g. via web UI: https://contacts.google.com/
Open the settings menu (the gear icon on the top, left side) and select the entry Undo changes (or some similar text). Then you can select the date/time span you want to undo.
AFAIK the Google Contacts app also provides the functionality to undo changes in a similar way.

my contacts lost


Is Polygon (Matic) a layer-2 or a sidechain?

Question: People are calling Polygon both a layer-2 and a sidechain even though these are 2 different concepts. Which one is it?
Answer: Short Answer:
Polygon PoS can be considered as a combination of sidechain and layer2 solution because it is a separate chain that has its own consensus mechanism but also uses the main Ethereum layer for some features in its consensus mechanism to improve security.
Long Answer:
Polygon is a platform (framework) that offers many different scaling solutions (most of them are still in development phase), so we can't have a general answer for all of them.
Normally when people are talking about Polygon, they reference "Polygon PoS
" which is the most widely used and adopted Polygon solution, so I suppose the question is for this specific chain.
So is "Polygon PoS" a sidechain or a layer2?
Let's first discuss what these terms mean.
Based on the Ethereum docs:
Sidechain is:

A sidechain is a separate blockchain that runs independent of Ethereum and is connected to Ethereum Mainnet by a two-way bridge. Sidechains can have separate block parameters and consensus algorithms, which are often designed for efficient processing of transactions. Using a sidechain involves trade-offs, though, as they do not inherit Ethereum's security properties. Unlike layer 2 scaling solutions, sidechains do not post state changes and transaction data back to Ethereum Mainnet

Layer 2 is:

Layer 2 (L2) is a collective term to describe a specific set of Ethereum scaling solutions. A layer 2 is a separate blockchain that extends Ethereum and inherits the security guarantees of Ethereum.

On the Polygon official site, the "Polygon PoS is called "An EVM enabled sidechain" which sounds reasonable because it is a separate chain with a separate mechanism, but also its consensus mechanism has a lot of extra features that rely on the security of the main Ethereum layer.
In this video Finematics explains how the Polygon PoS consensus mechanism works.
The combination of a sidechain that uses the main layer for some additional security features is called a "Commit Chain". I didn't find an official uses of this term.
So the final answer must be:
Polygon PoS can be considered as a combination of sidechain and layer2 solution because it is a separate chain that has its own consensus mechanism but also uses the main Ethereum layer for some features in its consensus mechanism to improve security.
Comment: Does polygon categorize as an optimistic roll-up or a zk roll-up?
Comment: @user610620 Polygon Ecosystem is building roll-up solutions, but they are still in the development phase. Polygon PoS is NOT a roll-up solution. it is actually based on Geth nodes (excluding the consensus mechanism).
Comment: @user610620 also interested in this
Answer: A blockchain doesn't exclusively have to be one or the other - it can be both a sidechain and a layer-2. They aren't opposites.
A sidechain refers to a blockchain which has it's own consensus mechanism and doesn't depend on Ethereum for security.
A layer-2 refers to a blockchain that is improving upon Ethereum by adding scalability features (usually lower gas fees).
There's no reason why a blockchain can't be a side chain and a layer-2 at the same time, which is what Polygon is
Answer: A significant difference between layer 2 and sidechain -

Sidechains have security mechanisms of their own.
Layer 2 solutions derive their security from their parent blockchain while using their own tools to address scalability issue of parent blockchains.

Polygon is a Layer-2 scaling sidechain solution because it has an ecosystem of its own (POS Chain, Plasma Chains, ZK-rollups, Optimistic rollups, etc). And while it might be possible to classify these individual solutions in either of the two categories, polygon as a whole cannot of classified in either of them simply because Polygon's scope is much broader.
Hence, a lot of times for Polygon the terms L2 and sidechains are used interchangably.
Comment: could you edit your answer to describe what sidechains *are*, besides what it *has*
Answer: Sidechain is another blockchain that is connected to Ethereum by a two-way peg which allows users to transfer funds from the main chain to the sidechain and from the sidechain to the main chain. So polygon is a sidechain.

Layer-2 refers to a network or technology that operates on top of an
underlying blockchain protocol to improve its scalability and
efficiency.

So it is also layer-two.
From here

Polygon is a layer-two (L2) blockchain for Ethereum that uses
different scaling technologies to improve the scalability of the
Ethereum mainnet. It will connect Ethereum-compatible blockchains in
an internet of blockchains, similarly to the mechanism used by
Polkadot. It uses a modular "security-as-a-service" approach that
builds on Ethereum's security, or uses its own pool of professional
validators.
Polygon is working on different scaling solutions for Ethereum,
namely:

Polygon PoS: its Commit Chain, a proof-of-stake EVM-compatible sidechain already live.
Polygon Miden: a zero-knowledge rollup based on STARK.
Polygon Hermez: an open-source zk-rollup.
Polygon Avail: a standalone chain focused on data availability
Polygon Zero: another zk-rollup chain.
Polygon Nightfall: a privacy-focused rollup chain.
Comment: what is a "two-way peg"? Can't understand what was copy and pasted. could you walk through it. And what is your answer. Both a layer-2 and sidechain? Edit your answer then. How can it be both, I thought they're two different things, given the other person's answer.
Comment: why cannot it be both? each feature is not opposite each other
Comment: Explain how they are not mutually exclusive. That was the point of the question really.


What are the advantages and disadvantages of Third normal form and Boyce-Codd normal form?

Question: I know that 3NF makes a database more efficient and stores data according to relevance, which is more logical, but are there other advantages? and are there any disadvantages?
Answer: Third normal form(3NF) includes the rules of the lower level normal form, such as second (2NF) and first normal form (1NF). Similarly, Boyce/Codd normal form (BCNF) includes the rules of the lower level such as 3NF, 2NF and so on (see here). Normalization provides both advantages and disadvantages, some of them are mentioned below.
Advantages of  normalization:
Reduced data redundancy:
In each level of normalization a type of data redundancy (same data present in more than once) removed from the model. Once the redundancy is removed, it is easy to change the data since data is present in only one place.
Increased data quality:
By applying business rules, there is a smaller chance in storing unwanted data in the table. Also there is less need for storing null values.
Capturing complete business requirements:
In normalization we have to ask a lot of questions to business people, so our understanding of the business becomes stronger and requirements of the business are easy to capture.
Data modification anomalies (Insert, delete and update)  are reduced.
Normalization splits a entity into a smaller number of entities, so you will have more smaller tables, so it is easier for sorting, indexing and searching.
Since there are many smaller tables, you will have many clustered indexes, it will help you in query tuning.
A normalized data model can be easier to modify and maintain.
Disadvantages
With many number tables and joins in between those tables slow down the performance of the database.
Having a large number of tables consumes more development time for implementation.
A completely normalized database needs clear and broad understanding of the business, it takes more time to analyse and understand the business. I hope this will help you. Thank you.
Answer: Except a logical aspect - there is a performance one - you divide data to a smaller tables. Smaller tables = smaller indexes and faster search options, less memory and IO consumption.
One disadvantage, that I can think about is longer code - lots of joins to query tables. Another one is that divided data is not the best option for OLAP processes, that is why sometimes you'll see not normalized tables at Data Warehouse environments.


ContentControl's formatting leaks outside control

Question: I'm developing application level add-in plugin to Word 2007. Unlucky I've encountered minor problem with styling dynamically added content:
I've created Content control, and changed it's style with following code:
PlainTextContentControl plainTextControl =
   extendedDocument.Controls.AddPlainTextContentControl(
   currentDocument.ActiveWindow.Selection.Range,"ptcc1");

plainTextControl.Text = "hello world";

plainTextControl.Range.Font.Shading.BackgroundPatternColor = (WdColor)ColorTranslator.ToOle(Color.LightGray);
plainTextControl.Range.Borders.Enable = (int)WdLineStyle.wdLineStyleSingle;
plainTextControl.LockContents = true;

It works - inserted text control has border and gray background, but when i type text just after inserted element this style persist - newly typed characters are bordered and with background color as well. How to limit formatting changes to ContentControl only?
Answer: var document = Globals.ThisDocument.InnerObject;

PlainTextContentControl plainTextControl = Controls.AddPlainTextContentControl(
document.ActiveWindow.Selection.Range, "ptcc1");

works for me in word 2010 - so no guarantee! :)
cheerz


Cannot uninstall managed package because a custom object is referenced by a relationship field that has been deleted

Question: When I try to uninstall my managed package, it tells me that I can't because my custom object, Carrier, is referenced by a lookup field on Account. So I went to Account and deleted the lookup field. Now it's saying that I can't uninstall my package because the custom object Carrier is referenced by my deleted lookup field. (The lookup field now has "_del" appended to the end of the name to indicate that it has been deleted. I see an option to undelete it but no option to permanently delete it.) What do I do?
Answer: Figured it out. I had to navigate to the field in the Salesforce Classic interface in order to see the option to permanently delete the field.