Quantifying the impact of rates change on bond prices

Question: How can I quantify the impact of a change in interest rates on bond prices?
I know that in a classical textbook setting the answer would be to compute the modified duration of the bond and, to account for large movement, to add also a convexity term. However, in real life, the term structure of interest rates it is not flat and does not always move in parallel.
Am I correct in thinking that the only way is to take the current yield curve (e.g. the one provided in Bloomberg by the GC function), apply the desired shocks (for instance, +10bps to the 5 year maturity), and use it to reprice the bond? Or is there some form of closed-formula which can still be applied?
Comment: Does this answer your question? [Can one compute the total return of a fixed-rate bond without having the coupon?](https://quant.stackexchange.com/questions/74726/can-one-compute-the-total-return-of-a-fixed-rate-bond-without-having-the-coupon)
Comment: No, I believe this is actually a new question not posed here in the past.
Answer: Let's think of the bond as a set of fixed cash-flows (which it is, unless it's a floating-rate bond). These cashflows consist of the coupons and the face-value paid at maturity.
Unless the coupons are large, the modified duration is still a pretty good "back-of-the-envelope" estimate of the bond sensitivity to rates change, because the main sensitivity comes from the face-value paid at maturity:
Say the bond matures in 10 years: then you can (simplistically) think of the modified duration as the sensitivity of the bond price to % change in the 10y point on the yield curve (indeed, in the "perverse" scenario where some other points on the yield curve would move significantly but the 10y point wouldn't change, the bond price would not change by that much: again, unless the coupons are large).
Indeed, if you wanted a very precise calculation where every 0.5 bps is relevant (i.e. huge notional, long-dated bond with many larger coupons, etc), then you'd want to reprice the bond using all points on the changed yield-curve.
But if you are trying to hedge the bond exposure, duration + convexity is your best bet anyway: because there are an infinite number of permutations in terms of what can happen to the yield curve, so if you wanted to hypothetically understand the impact of all of them on your bond price, you'd need to come up with all these scenarios and reprice the bond under each of them, which is unrealistic.
Comment: I see, ok. It depends on he application. A trading desk running a large bond portfolio might definitely want a precise calculation, because each 0.5 bps will have a material impact on the PnL. Otherwise I would just stick with duration + convexity. Also, I would encourage you to investigate the difference between a full yield-curve reprice vs. Duration + Convexity approach: that way you will see if the difference is material for your particular case.
Comment: Many thanks, very useful. Just to be sure, my idea was to make this calculation for scenario analysis, not for every possible movements in the yield curve.  For instance, to asses the merit of owning a bond if you are convinced that the market is pricing a rate cut too early (i.e. if the bond yield is enough to compensate for negative price return).
Answer: It depends on your bonds, and on the kind of risk scenarios you want to consider, and how you intend you use these numbers.
As Jan Stuller points out in his excellent answer, modified duration is usually the equivalent of a good first approximation of the bond's sensitivity to 1 basis point shock to the curve in parallel - dv01. Further, key rate durations provide an approxiate way to decompose the dv01 into tenor buckets, useful if the bonds pay large coupons, or amortize - have material cash flows before maturity. The bucketed dv01s should approximately add up to the parallel shift dv01. In an example use case where you want to figure out the notionals of interest rate swaps to hedge the inerest rate risk of a portfolio of bonds, and if you intend to dynamically re-calculate the hedges frequently enough, as the bucketed dv01s change with time, then this approximation may be accurate enough. Or not.
But there are a few situations where you may prefer to do something more complicated:
If the bond or a loan is a floater, paying coupon RFR + spread (or even RFR * gearing in some markets), and the interest rates move in parallel, then the coupons change to offset the change in the present value of the principal repayment. But the fixed spread contributes some interest rate risk. If your book has risky floaters paying spreads over RFR in the hundreds of basis points, you may prefer not to assume that they have no interest rate risk, but rather include it in your hedging. Also if you want to decompose the dv01 into tenor buckets, or if you want to know the impact of non-parallel curve perturbations (e.g. flatteners / steepeners scenarios), then the coupon changes no longer offset the principal.
Likewise, if the bond pays fixed coupon, but is trading at a price below that implied by just pricing its cash flows at RFR - then its price is probably driven down by something else - perhaps credit risk. It's likely that an interest rate shock will affect this bond less than it would affect a purely rates instrument.
One possible approach is to calculate a Z-spread-like idiosyncratic spread - solve for a parallel shift in the interest rates that would explain the observable bond price - then perturb the interest rates and reprice the bond's cash flows keeping the idiosyncratic spread constant.
For a lot of higher-yielding bonds this should provide better P&L explanation, and more effective hedges, than modified duration, in a sense that the Z-spreads would be stable day to day in the absense of idiosyncratic news. It doesn't really matter whether you use the general colateral curve (which is your cost of financing the bonds) or some other interest rate curve. But the assumption that the Z-spread would not change when interest rates move a lot isn't very realistic either. You don't want to base your decision to trade a corporate bond trading now at 300 bps Z-spread on the asumption that its Z-spread won't change when interest rates move 400 bps.
You might get better predictions for credit-risky bond prices if you make some assumption about the loss given default, then solve for either the probabilities of default or for CDS spreads implied by observed price, then reprice the cash flows using perturbed interest rates to discount.
Also, some bonds' cash flows have some optionality. Consider, for example, a bond paying 8% fixed, maturing in 10 years, but callable after 2 years. If the bond is not called until maturity, then it has a lot of interest rate risk. But if the bond issuer can refinance at 5% coupon rate because their credit has improved and/or the interest rates are down, then they will probably exercise the call, in which case there is less interest rate risk. Models that predict whether the debtors will exercise their options under interest rate shocks can get pretty hairy, particularly prepayment rate models for collateralized mortgage obligations and mortgage backed securities. My point is, very material higher-order relationship may be much more complicated than just rate convexity, and may affect the prices a lot under a large rates movement.


How to decide whether an attribute scales well with certain skills?

Question: Reading several guides and build regarding Guildwars 2 characters I often come across mentioning of attributes that scale well or not so well with certain skills. For example, power, supposedly, scales badly with the Necromancer's scepter skills. It is therefore advised to take precision with scepter because it scales better.

What I've come to understand is that skills use a certain formula according to attributes to come to their final damage output, and based on this formula some attribute contribute better than others.

I would like to know how to decide which attributes scale best with an arbitrary set of skills for any given class. Is there a way to figure this out rather than applying empirical testing?
Answer: Generally, this information is worked out through a process of testing and theorycrafting. If you want to skip these stages, you can simply use a resource that has already done the testing and theorycrafting to establish the build you should be using.
One such resource is Noxxic, but there are many others.
Using Noxxic in this example, you would simply select your profession from the drop down followed by the type of build you want (Control, Support or Damage) and you will receive suggestions on weapon types to use and which statistics you should be stacking;

As you can see from the above, this site already contains a large amount of the statistical information you're asking for but without spending time testing and theorycrafting.
Comment: Thank you for you suggestion however I still don't seem to find the information that I'm after. This seems to be a build calculator which presents me with some information regarding expected damage output. What I'm trying to do is compare `attribute X` with `attribute Y`. In your example above which attribute is the calculator suggesting I should stack? And which not? I'd hoped it would say "don't stack power, stack precision".
Comment: In the above screenshot, look under 'Primary Stats' near the bottom - for this particular build, it's suggested to stack Power and Precision equally - so in the instance that you want to set up your Necromancer to Control (or DPS, since for Necro the two roles are sharing stats) you should be aiming for roughly equal amounts of power and precision. If you wanted to go for a more 'Support' role, you would go Vitality > Toughness > Power
Answer: The main strategy for this is three-pronged. First, look at your traits: one or both of the attributes associated with the trait line that contains traits improving that weapon will usually be the attribute(s) that benefits that weapon the most.
Next look at the skills the weapon provides, especially the auto-attack. If it inflicts conditions, you probably want condition damage and some condition duration. If it attacks quickly, you may want a lot of precision, to try to rack up a lot of bonuses from crits. If it heals you somehow (necromancer dagger, guardian mace, elementalist water daggers) you may want healing power. If its attacks are slower and don't have any particular other attribute benefiting them, you probably want power. Usually you should be ending up with one (or both) of the two attributes you identified in the first stage; if it's not, proceed carefully, as this may mean you're not imagining playing that weapon the way ArenaNet designed it to play.
Finally, if you still have attributes you can be boosting, take a look at the attributes that synergize well or would cover some of your weaknesses. If you're boosting condition damage, condition duration tends to work well. If you're boosting precision, a little extra crit damage % goes a long way. If you're pumping power, a little precision can help noticeably. Alternately, cover your weak areas. If you're heavily invested in an offensive trait line and have pushed a bit into a 2nd offensive line, consider going relatively deep into a defensive trait line to pick up some toughness or vitality. High vitality builds also probably want healing power, so they can actually restore all those hit points.
Lets take scepter for the necromancer as an example. First we look for the traits that improve scepter; we find them in the Curses line, which boosts precision and condition damage. Next we look at the scepter's basic attack and notice a decent attack speed and not one but two damaging conditions inflicted. Condition damage will definitely be our primary damage stat, and since boosting its trait also boosts precision, we'll want to keep an eye out for ways to cause conditions on crits as well as further precision boosts. Finally we consider other attributes; with all those conditions & condition damage, some condition duration would be helpful, and some extra power, which condition duration shares a trait line with, never hurts. We may also want to grab a defensive stat, though, to try to avoid being a glass cannon; if we've got anything with lifesteal in our off-hand it may be worth grabbing vitality & healing, otherwise I tend to gravitate towards toughness.
Here's the build I use on my scepter necro (off-hand warhorn, staff secondary) in sPvP:


Tried everything but still get "native typeface cannot be made"

Question: In an app I am building, I'd like to use the standard Apple font: Myriad Pro. To do this, I've tried the normal way of using a custom font:
Typeface myriadPro = Typeface.createFromAsset(getAssets(), "fonts/myriad_pro.ttf");

And the workaround for an issue that Android sometimes has with fonts as discussed here:
public class Typefaces {
private static final String TAG = "Typefaces";

private static final Hashtable<String, Typeface> cache = new Hashtable<String, Typeface>();

public static Typeface get(Context c, String assetPath) {
    synchronized (cache) {
        if (!cache.containsKey(assetPath)) {
            try {
                Typeface t = Typeface.createFromAsset(c.getAssets(),
                        assetPath);
                cache.put(assetPath, t);
            } catch (Exception e) {
                Log.e(TAG, "Could not get typeface '" + assetPath
                        + "' because " + e.getMessage());
                return null;
            }
        }
        return cache.get(assetPath);
    }
}
}

I've tried both methods with the OTF and the TTF versions of the font. None of the variations work. In all cases I get the native typeface cannot be made error (i.e. it can't find the typeface), even though the typeface is in the right place with the right name.
Any ideas what's still causing this error to occur?
Answer: I had the same problem.
Go to the AndroidManifest.xml.
minSdkVersion MUST be 10 or higher.
Comment: Hmmm.. I changed the minSdkVersion to 10 but the problem persists.
Comment: Oddly enough, it works for me. This is weird. I'm not comfortable about fixes I don't entirely understand.


Data Scraping on USPTO

Question: Anyone performed data scraping on USPTO?
someone has a tool/code that can be used to extract data from USPTO and have it as SQL DB?
Comment: Is there a reason you aren't considering other patent databases like The Lens or Google Patents?
Comment: is there a way i can extract data from those tools?
Comment: I gather it's in development for The Lens. Google patents seems to provide public data: https://console.cloud.google.com/marketplace/details/google_patents_public_datasets/google-patents-public-data?filter=solution-type:dataset&q=google%20patents%20public%20datasets&id=2877ec09-debc-41bd-a2d7-df1fd089e4d0
Comment: where can i find documentation on how to use it? i can see it is SQL it is easier than USPTO search
Comment: I've never done it myself. Maybe google searching?
Comment: a link to the USPTO's bulk data info page https://www.uspto.gov/learning-and-resources/bulk-data-products
Comment: What USPTO data are you looking for?
Comment: i need patents for universities that belong to specific IPC also patents for corporations with same IPCs and patents that were submitted by both universities and corporation

i need the data to be searchable
Answer: Here is a python project that scrapes the USPTO raw data files and parses them into CSV files, MySQL, and PostgreSQL databases.
https://github.com/rippledj/uspto
Answer: IP Watchdog recently ran a story about recent developments in obtaining bulk file wrapper data from the USPTO.  It also describes the efforts of various companies in "scraping" data from USPTO databases.
Some file wrapper data is available for bulk download from Patent Examination Data System.  This contains complete file wrapper data, for those applications open to public inspection, from 1981 to the present (updated daily).  The data prior to 1981 are incomplete.  The downloads are in JSON and XML file formats, which can be imported into a database.
The USPTO also provides some large data sets as "Research Data Sets".
Answer: in terms of data quality and reliability, this seems the best: https://www.uspto.gov/patents/search, but without APIs.
The APIs here https://developer.uspto.gov/ibd-api/#!/bulkdata/searchPatentGrantData seem not working: i only tried grants and applications, these direct calls.
Answer: Data scraping is much harder than you think. While all the file wrappers are available in PDF, before electronic filing became common the originals were on paper, and the PDF is just an image file.
Sometimes the paper has handwriting on it, although this is rare.
The file wrappers have invaluable information on what prior art was cited against the application, and how the applicant amended the claims, and unfortunately there's no good way, AFAIK, to get all that automatically.
You think "Oh, I'll just OCR it" ? The OCR quality is really bad!
Answer: You should take a look at patent_client! It's a python module that searches the live USPTO and EPO databases using a Django-style API. The results from any query can then be cast into pandas DataFrames or Series with a simple .to_pandas() call. Once in Pandas, you can use its SQL ingestion functions to load it wherever you need it!
from patent_client import USApplication, Inpadoc, Patent, PublishedApplication

# USPTO databases
USApplication.objects.filter("filter criteria here")
Patent.objects.filter("filter criteria here"
PublishedApplication.objects.filter("filter criteria here")

# EPO databases
Inpadoc.objects.filter("filter criteria here")

A great place to start is the User Guide Introduction

PyPI | GitHub | Docs
(Full disclosure - I'm the author and maintainer of patent_client)

Data Scraping on USPTO


How to explain KNN in Bayesian probability?

Question: I am wondering how to explain k-nearest neighborhood algorithm from a Bayesian approach, especially on how to justify the best choice of k value?
Comment: Are you looking for the lowest possible error rate of knn with respect to bayes approach? The Duda & Hart book is pretty good at linking the two.
Answer: kNN from a Bayesian viewpoint
Let suppose that we have a data set comprising $N_{k}$ points in class $\mathcal{C}_{k}$ with $N$ total points, so that $\sum_{k}N_{k} = N$.
We want to classify a new point $\mathbf{x}$ by drawing a sphere centred on $\mathbf{x}$ containing precisely $K$ points irrespective of their class. Suppose that such a sphere has volume $V$ and contains $K_{k}$ points from class $\mathcal{C}_{k}$.
Then,
$$ p(\mathbf{x}|\mathcal{C}_{k}) = \frac{K_{k}}{N_{k}V}$$
provides an estimate of the density associated with each class. Similarly, the unconditional density is given by
$$ p(\mathbf{x}) = \frac{K}{NV}, $$
while the class priors are given by
$$ p(\mathcal{C}_{k}) = \frac{N_{k}}{N}. $$
We can now combine the three equations using Bayes' theorem to obtain the posterior probability of class membership
$$ p(\mathcal{C}_{k}|\mathbf{x}) = \frac{ p(\mathbf{x}|\mathcal{C}_{k})  p(\mathcal{C}_{k})}{p(\mathbf{x})} = \frac{K_{k}}{K}. $$
If we wish to minimize the probability of misclassification, we have to assign the test point $\mathbf{x}$ to the class having the largest posterior probability, corresponding to the largest value of $\frac{K_{k}}{K}$.
Comment: Sorry for this interrupting question. But when you give the unconditional density, $p(x)=K/NV$, is it well defined? i.e., if I integrate $p(x)$ over whole space, may I get $1$ in the end?
Comment: what is P(x) ? How do you define it?
Answer: As explained in detail in this other answer, kNN is a discriminative approach. In order to cast it in the Bayesian framework, we need a generative model, i.e. a model that tells how samples are generated. This question is developed in detail in this paper (Revisiting k-means: New Algorithms via Bayesian Nonparametrics).
The approach follows two steps: first finding a smooth version of k-means (GMM) and then use the Dirichlet Process (DP) to model the mixture of Gaussians.
The first step builds upon the asymptotic relationship between kmeans and GMM. This is necessary in order to have an efficient model of the conditional probabilities, for which we have efficient sampling algorithms.
As already said, the DP models the distribution of Gaussian mixtures which could have generated the observed data. Initially one may even have an infinite number of components!. The goal is then to find the likeliest values that could have generated the data.
Comment: This question is about k-nearest-neighbours (kNN), while this answer only mentions k-means. What is the relation?


How to determine IP address of target device or network

Question: I know most exploits over the internet are opportunistic, but assume an aggressor has a specific target, but no physical access to that target. How do you find the target network or device to begin an attack over the internet? My first thought is social engineering, if the adversary can convince the target to access a resource under the adversary's control, then the adversary can obtain the target's IP address that way. What are some other possibilities?
Answer: This is the combination of two stages of penetration testing, known as information gathering and enumeration.
Information gathering is the preliminary process of collecting information about your target. This is often divided into passive (no contact with target) and active (contact with target). It can take many, many forms from social engineering, nameserver enumeration, website research, and more.
Enumeration generally refers to discovering and listing resources within the network, such as servers or user accounts. Typically, this phase occurs after the attacker has already gained access to the network, but in cases where the configuration is poor or data is otherwise leaked, it may be accessible without such a foothold.
Answer: If the target is a known company you might be able to see if there are vulnerabilities on it's website, and you can use that to get some public facing IP's, but you'd have to make sure it's not a rented hosting service. A reverse 'whois' might also help you figure out what IP's the target owns, unless they mask their info. Otherwise I'm not 100% how else you would do it besides the phishing idea you already mentioned.
Answer: Two possible approaches:

E-mail

Finding the IP address could be as simple as sending an E-mail to the target and waiting for a reply. The sender IP address will often (but not always) be revealed in the mail headers.

Whois

Some larger corporations have designated IP ranges assigned to them. For American enties arin.net would be the source. Their whois service also supports wildcard search. See: Quick Guide to ARIN's Whois
Other useful sources include Robtex, bgp.he.net.
In this case you will usually end up with an IP range instead of a single IP address, but it's a start.


Remove [gallery] shortcode altogether

Question: I used remove_shortcode('gallery'); ...the gallery is gone, but the shortcode is visible in the text. How do I remove sitewide? I've searched for sql queries, but no solution fixes my specific  problem.
Answer: You can make it invisible with a simple trick:
add_shortcode( 'gallery', '__return_false' );

This will remove the code from output without touching the post content.
Comment: Nice trick! A single line of code instead of a lengthy process. +1
Comment: @bungeshea, this guy is a [magician of higher arts](http://meta.wordpress.stackexchange.com/q/1306/12615), I'm still waiting for a trick in his magic bag that won't surprise me ;)
Answer: The short code is actually entered into then page or post content so disabling the short code processing prevents the gallery short code from being replaced with the gallery images but it doesn't affect the post content.
The best solution is to add a new short code handler after removing the default gallery handles.  Another less desirable approach would be to remove the short code tag from all posts and pages.
Short code replacement would look something like this:
function no_gallery($atts) {
    return "";
}
add_shortcode('gallery', 'no_gallery');

Comment: +1, synchronized with the *sensei*, but 1 line of code better than 4 ;)
Answer: The empty shortcode is a very nice trick, but if you want to remove the string [gallery] from all posts, there are two options: manually in the dashboard or a database search/replace.
Although the database could be manipulated directly, in those cases (content replacement), I prefer to use the plugin Search and Replace, by Frank Bültge.
As any database manipulation, backing up is essential.

Remove [gallery] shortcode altogether


Looking to create a dropdown field to select an icon

Question: I use the same icons across most of my projects, and typically just list them in Dropdown fields. However, this quickly becomes difficult to manage, so I'm looking to create a simple plugin that I can easily reuse.
I've started with pluginfactory.io to scaffold it out, selecting the Field Types component and installed via Composer but struggling from there.

How do I define the list of icons that should show in the dropdown field?
How do I get that to then reference the correct SVG file?
How do I output that properly in my templates with <code>{{ entry.icon }}</code>?

I realise that's literally asking how to build this thing  but I would appreciate some guidance!
Answer: What you are describing sounds a lot like the Position Fieldtype. I would look at that plugin for guidance.


PTIJ: Mordechai's politics

Question: In Megillat Esther, Mordechai is described as an איש ימיני, a right-winger. Why does he feel it necessary to defend his political positions in his megillah?

This question is Purim Torah and is not intended to be taken completely seriously. See the Purim Torah policy.
Comment: I read that as he is a "Ish Yemeni" a man from Yemen.
Answer: You assume that this was written by Mordekhai. However, let's not forget that Hadassah co-authored it (cf. Ester 9:29, Megillah 19a). Hadassah could certainly be characterised as more left-leaning. Accordingly, it is unsurprising that she noted Mordekhai's right-leaning tendencies.
Answer: It's pretty simple, actually.
He's a "right" winger, meaning that his politics and the way he did things were "right" meaning "correct". He was looking out for the king's best interests. (He saved the king's life, afterall.)
In contrast, Haman was wrong. By attempting to destroy the Jews, he would have severed a significant source of the king's income. He wasn't looking after the king's interest. He was wrong and, therefore got "LEFT" over on a tree.
Answer: If the left wingers of his day were anything like the left wingers of our day, they would have been pushing to assimilate into the Persian society of their time. Like J Street nowadays, they complained that he should have bowed to Haman and not insisted on being religious. They also complained that he caused anti-Semitism by not surrendering to the cultural superstitions of their day.
Answer: Immediately preceding that he is described as a בן יאיר, a son of your ear. If so, you may have thought he's a socialist, as he wants your ear. Ka mashma lan איש ימיני. If so, what does בן יאיר mean? It must refer to the fact that he was a prominent member of the Sanhedrin, and, as such, always had people's ears when he spoke.
Comment: Potentially stupid question - was there a "Sanhedrin-in-exile"during that time? Was it an impropetu or official "council of elders" or something else that handled Jewish relations with the Persian government?
Comment: @Gary Not sure. But we know he was in the Sanhedrin at least before the Galus, and that he was hanging around the palace gates where the judges would sit at the beginning of the story before being promoted by the end.
Answer: He wanted to stress that he was a true Republican, and and not a Republican In Name Only (RINO).
As we all know, the rhino does not divide the hoof and for this reason is not kosher.
Answer: We can understand this based on the current political situation, where there are two Binyamins vying for the position of prime minister (the position that Mordechai eventually ended up with).
Mordechai, the Megillah tells us, was from Binyamin. But which one? The answer is that he's on the "Netan-yahu" side - recognizing everything he has was given to him by Hashem, rather than on the "Gantz" (Yiddish for "complete") side, thinking that he's complete as is.
Answer: In the final 3 verses of the Megilla, we see that Achashverosh raises taxes on his kingdom.

וַיָּשֶׂם֩ הַמֶּ֨לֶךְ אחשרש [אֲחַשְׁוֵר֧וֹשׁ ׀] מַ֛ס עַל־הָאָ֖רֶץ
  וְאִיֵּ֥י הַיָּֽם׃
King Ahasuerus imposed taxes on the mainland and the islands.

Then he puts in Mordechai as Prime Minister.

וְכָל־מַעֲשֵׂ֤ה תָקְפּוֹ֙ וּגְב֣וּרָת֔וֹ וּפָרָשַׁת֙ גְּדֻלַּ֣ת
  מָרְדֳּכַ֔י אֲשֶׁ֥ר גִּדְּל֖וֹ הַמֶּ֑לֶךְ הֲלוֹא־הֵ֣ם כְּתוּבִ֗ים
  עַל־סֵ֙פֶר֙ דִּבְרֵ֣י הַיָּמִ֔ים לְמַלְכֵ֖י מָדַ֥י וּפָרָֽס׃
All his mighty and powerful acts, and a full account of the greatness
  to which the king advanced Mordecai, are recorded in the Annals of the
  Kings of Media and Persia.

Nevertheless some Jewish people still blamed Mordechai for the higher taxes, which is why he was popular only with the majority of the Jews, but not all.

כִּ֣י ׀ מָרְדֳּכַ֣י הַיְּהוּדִ֗י מִשְׁנֶה֙ לַמֶּ֣לֶךְ אֲחַשְׁוֵר֔וֹשׁ
  וְגָדוֹל֙ לַיְּהוּדִ֔ים וְרָצ֖וּי לְרֹ֣ב אֶחָ֑יו For Mordecai the Jew
  was second to King Ahasuerus and was great to the Jews and popular
  with most of his brethren

Thus the Megilla informs us at the beginning that Mordechai was a right winger who didn't want to impose taxes, but couldn't stop Achashverosh from imposing them.

PTIJ: Mordechai's politics


Is it true that every Banach space has Bolzano Weierstrass property?

Question: Is it true that every bounded sequence in $C[0,1]$ with sup norm has convergent subsequence? I really feel this statement is true and the crux of the proof will lie in that $C[0,1]$ is complete. But I am unable to prove it mathematically by constructing a Cauchy subsequence for any random sequence ( which will eventually be convergent). Also is my observation correct that every Banach space has this property?
Comment: Actually, not at all. The only normed vector spaces whose unit balls are compact are finite-dimensional spaces.
Comment: Any normed space $X$ has the BW property iff it is finite-dimensional.
Comment: means if X is finite dimensional then it will have BW property?
Answer: It is not true. The sequence $f_n(x)=\sin nx$ is a uniformly bounded sequence in $C([0,1])$, but it doesn't even have a pointwise convergent subsequence, let alone one in the sup norm.
To identify families where you have a positive result, you can use the Arzela-Ascoli theorem. That is, you just need to check that your family is pointwise bounded and equicontinuous.
Comment: @believer indeed, this follows from a finite dimensional space being isomorphic to $\mathbb{R}^n$ for some $n$. See https://math.stackexchange.com/questions/144464/bolzano-weierstrass-theorem-in-a-finite-dimensional-normed-space for details.
Comment: I think $f_{n}=x^{n}$ will also work na!
Comment: Also one quick question I also asked in above comment.." can we say if X is finite dimensional then it has BW property"
Answer: Its not true. Consider $f_k(x) = e^{i2\pi kx}$. If $k< j$ are integers, then
 $$\|f_k-f_j\|_{\infty} = \sup_{x\in[0,1]} |1 - e^{i2\pi (j-k)x}| \ge  |1 - e^{i2\pi (j-k)\frac{1}{2(j-k)}}| = 2.$$
Consequently there is no Cauchy subsequence.
Essentially the same example by thinking of Fourier coefficients - you can try the Banach spaces $\ell^p(\mathbb N)$ where now the sequence of elements $f_k \in \ell^p(\mathbb N)$ are defined by $f_k(n) = \delta_{nk}$.


low stock notification to admin without any extension in magento 1.9

Question: I want to create the custom module for email sent to admin for notifying when the product is low qty in magento 1.9.x.
Answer: Hey you can do it using cron jobs what you have to  do is create a cron job and in its function you need to load the whole products and check which product has low stock you can set limit like only those product which has only 10 QTY left you can get their sku in an array once you have an array of sku then you can send the details in mail to your admin.
Benefit of using cron job is you can set timings like you can check product stock in every 2 days or 3 days according to you.
Answer: Try this module for Magento low stock notification
https://github.com/geekster909/magento-low-stock-notification
Comment: I fixed Notify for Quantity Below 5 and I change the qty is  2 in inventory option by admin panel of the product and also write down the email id in mail option in observer.php but still, I am not getting any mail...please help
Comment: simple `mail()` function is enabled on your server ?


Mystery rubbing or slapping noise while driving

Question: My 2005 Dodge Caravan makes a strange rubbing or slapping noise under the hood that is quite loud and has to do with rotation of the tires or front axle. As you slow down it slows down and vice versa if you speed up. It stops when vehicle stops. It doesn't start doing it until after getting out on road for a few minutes and doesn't do it all the time. I crawled under it hoping to find something maybe wrapped around cv axle or tire, but nothing was vizable. It almost sounds like something hitting against firewall or bottom of hood. It also doesn't interfere with performance of engine or trans...
Answer: Try checking your fan belt. It could be coming apart and only making noise when you get up to certain speed


Quit photography in 2006. Ready to restart, Have good lenses still but need advice on picking right body

Question: I ran safaris using a Canon EOS20D, and a clutch of what are now "L" lenses and not "L II", e.g. "EF 24-70mm f/2.8L USM" and "EF 70-200mm f/2.8L IS USM". Had to quit, but kept all my gear. Clearly, i need to ease into a more advanced camera body. The Canon Mark 5D III model seems along what I'd eventually like to get back to, and would be something that seems to be one I could hold onto as a second body hopefully. I'm curious if the first edition Canon L lenses are going to hold up, quality-wise. I was familiar with the limits of the IS in the L zoom models when I was using them. I don't mind upgrading way in the future, but assuming that my eventual goal would be along the lines of what's speculated about the potential release of a Canon 5D V later this year, do 1st edition Canon L IS lenses seem reasonable to work with for a while?
Comment: Well, you should be able to get the 5D III used for a good price, why not just go for it.
Comment: There's far too much that's down to individual requirements/expectations/style/goals. However, personally I would recommend either the 7D Mark II (yes, it's a crop sensor, but in my experience it works great with EF L lenses, and even gives you the illusion of a little extra telephoto reach; not the best in low light, though) or a 5D Mark IV (you could do the Mark III if you want, but make sure you examine all the improvements made in the Mark IV). You could even look at one of the new mirrorless models with the EF adapter...
Comment: Why do you "clearly... need to ease into a more advanced camera body"?  Have you considered mirrorless with electronic adapter?
Comment: Thanks so much for the quick responses. Yeah, I was avoided a crop sensor. And I've completely missed the mirrorless arrival other than just picking up an ELPH (please don't snicker, it's for concerts). I like being able to have my fingers on knobs and buttons that click so everything is in my head and not on a screen. I know they seem to be the way forward with plenty of advanced tech, but I think for what I did, the joy was in adjusting on the fly and never leaving that eyepiece. That took years of practice, hence needed to ease back into old skills and new options. :)
Comment: Am just on that tipping point, and I think sums it up pretty well. It was much easier when starting the business and money was available for new tech! Cheers
Answer: Those L lenses age very well. Meaning, there is almost no reason to quickly upgrade to the newer models. It is very reasonable to keep your "old" lenses. Yes, the IS is better now but that's really small differences in really high end products.
So I'd start with getting a current body and start shooting. The "old" lenses won't hinder you in any way. IF you think you are resticted by the lenses, you can still upgrade at a later time.
Comment: So good to hear. I was really worried that the tech had somehow changed between the bodies and II lenses making more responsive or something. It seemed plausible after not touching a camera for 14 years and the last time I did was when mine was RAPIDLY going out of date. Thanks. I was hoping to hear news along those lines as well.
Answer: Since you've set down photography and are revisiting it now, it's my guess that the question is less about the camera, but how you'll feel getting back into it, and what the activity will mean for you/how you'll use it. (If you know this, sharing would help the recommendation.) For that reason, I'd suggest the best value-buy in the ballpark of your skill.
The Canon 6D has been very good to me, as an 'entry level' full frame that should be more than sufficient to get you warmed back up. I picked up a 6D Mark ii refurbished (by Canon) for $800 a few months ago.
Then, once you've got a camera in hand that you're not afraid to use (it takes less to justify going out for pictures with a $3000 body vs $800, in my opinion), you can start to answer the more personal question about which technology is worth my money, these days.
Comment: I was asking and have been appreciating the answers because it's not so much a revisiting as it would be a return to a major hobby. I'm not looking to get anything new now, just trying to refamilarize myself with the new bodys, knobs, buttons, and seeing if or how quickly it comes back. Thanks for the suggestion on the 6D Mark ii, will look into it!


How to understand Ubuntu UEFI Secure Boot install?

Question: Now that Secure Boot is supported, what special instructions does one have to follow to install Ubuntu on a UEFI Secure Boot enabled PC shipped with Windows 8?
As I understand, Ubuntu >= 12.04.2 ships with signed GRUB2. I searched but cannot get past the "supported" statement. I am looking for specific instructions on registering Ubuntu keys to let the firmware boot Ubuntu.
UPDATE:
Thanks. SecureBoot in Ubuntu 12.10 gives me the answer. The Ubuntu first-stage EFI bootloader is signed by Microsoft. The last time I read, Ubuntu had plans to publish their own key which had to be registered in the firmware's database before installing. May be I did not track the story long enough to realize that it is not the case anymore.
Comment: Related (but probably not a duplicate, this is a general practical question about how to install Ubuntu on  a Windows 8 machine, whereas the answers here give background, explain "secure boot" and so forth): [Installing Ubuntu on a Pre-Installed UEFI Supported Windows 8 system](http://askubuntu.com/questions/221835/installing-ubuntu-on-a-pre-installed-uefi-supported-windows-8-system)
Answer: Probably start here: help.ubuntu.com/community/UEFI
UEFI (~EFI) is a firmware interface that is widespread on recent computers, especially those more recent than 2010. It is intended to replace the traditional BIOS firmware interface that is prevalent on earlier machines. This page provides information about installing and booting Ubuntu using EFI, as well as about switching between EFI mode and legacy BIOS mode using Ubuntu.

UPDATE:
Ubuntu 12.10 is intended to be able to be used with Secure Boot.
Softpedia (Sep-2012) >> Canonical Unveils Plans for Ubuntu 12.10 Secure Boot

Canonical, through Jon Melamut, announced on September 20th that they will plan to implement support for Secure Boot in the upcoming Ubuntu
  12.10 (Quantal Quetzal) operating system.
Therefore, after a discussion with Free Software Foundation, Canonical decided to drop the EFILinux bootloader implementation in
  favor of the GRUB2 bootloader one, signed with their own keys. ..

Muktware (Oct-2012) >> SecureBoot In Ubuntu 12.10

Ubuntu 12.10 is the first distro that supports the Secure Boot architecture by default. Canonical developers have spent a huge amount
  of time making sure that Ubuntu runs fine and without problems in all
  hardware. Steve Langasek, an Ubuntu developer has put forward a nice
  account in his blog, regarding how they are making Secure Boot
  supported.

closes with ..

Langasek says that they will backport the secure boot mechanism to Ubuntu 12.04 release as well, so that the LTS version can be installed
  in Secure Boot devices. So the next major service pack of Ubuntu
  Precise (12.04.2) will include support for SecureBoot.
Comment: Thanks for the response. I have read this article. My question is not about UEFI. It is UEFI with Secure Boot. Nowhere in this article is there a mention of how to deal with secure boot enabled PC. Please can you point me to some resource that helps me install Ubuntu on a secure boot enabled PC?
Answer: There is a problem on some machines, particulary laptops - They don't appear to have the "Microsoft Windows UEFI Driver Publisher" public key installed in their BIOS to allow the signed Ubuntu boot loader (and other UEFI software such as ours)  to run with Secure Boot option enabled. This is NOT the same key, which Microsoft use to sign their own UEFI Windows Boot Manager and it appears that some BIOS implementations only have this Microsoft exclusive public key.
The solution is either:

For Microsoft to sign third party UEFI binaries with the SAME key as they use for their own bootloader.
For BIOS vendors/computer hardware motherboard manufacturers to be sure they include the data to allow "Microsoft Windows UEFI Driver Publisher" signed binaries to work correctly.

On a Windows 8 machine,  enter Mountvol Z: /S in an admin elevated command prompt box. Then in the command prompt do:
copy Z:\EFI\Microsoft\*.efi    C:\test

Where Z is an unused drive letter.
You can then check in (already created) C:\test folder the digital signatures on the Microsoft .efi files and see that the name of the key is different to the key they used to sign the Ubuntu boot loader.
The Ubuntu boot files can be found in X:\EFI\Boot where X is the CD drive letter.
This needs sorting out, and sorting quickly.
Our research indicates that of laptops tested so far, only ASUS laptops have the correct keys installed in their bios, but we haven't yet managed to check everyone. I am not mentioning here, the names of machines which won't work, but one is a similar name to the one which does!
Comment: It appears that ThinkPads have the right keys out of the box.
Answer:
First install Ubuntu-Secure-Remix-64bit (or Ubuntu12.10 64bit) and use Boot-Repair's Recommended Repair as described in the first paragraph of https://help.ubuntu.com/community/UEFI
If that fails, disable SecureBoot in your firmware as described here: https://help.ubuntu.com/community/UEFI#SecureBoot , and run Boot-Repair again.
Answer: Have posted a similar question six months ago and due to being unable to load kernel led to installing a non-linux alternative OS to prove that my firmware and hardware were at least working as expected.  The intention was to have this new hardware be my first that had never seen Windows so maybe next time...
Since starting on the quest to make use of the EFI capabilities of my newest hardware have been spending some time on these very useful pages which includes a good synopsis of how to perform an Ubuntu install on a Secure Boot enabled machine and highlight there are other options other than relying on Grub2 and signed keys from Microsoft. Which the link in your update to question indicates as the be all and end all.  Just thought would share this is not the case. As the last link in this paragraph shows using rEFInd and your own keys it is possible to manage a linux install with Secure Boot enabled. Which is one of the many options mentioned if not described in detail. Hope you enjoy the reading as much as I!
The alternative is to turn Secure Boot off. I would personally at least try the method described shortly and sweetly by LovinBuntu.
Another useful source of helpful information regarding all things U/EFI is the wiki article here. Which helps describe and specify Windows 8 demands UEFI >= 2.3.1 (latest is now 2.4) and Secure Boot is available from >= 2.2 UEFI specification.
(the wiki page linked shares a link for a similar page EUFI page which scares me no end!  Science fiction is not fiction!:p)
Some more links for further reading:

UEFI Official Website
Extensible Firmware Interface (EFI) and Unified EFI (UEFI)
UEFI Support and Requirements for Windows Operating Systems


Which one sounds more natural: "is there any difference" or "are there any differences"?

Question: "is there any difference between ..." or "are there any differences between ...", which one sound more natural? I searched both in Google Books and both have a lot of results.
Comment: Both 'sound natural'. The first asks about uncountable difference (the fact of being different) and the second asks about countable differences.
Comment: @MichaelHarvey could you give me an example of what uncountable difference and countable difference are? I'm sorry I don't quite understand.
Answer: We use a singular form when we mean or expect one difference. This could be a difference of nature.
Is there a/any difference between these balls?
One is red and the other blue
One is wooden and the other made of rubber
Is there a/any difference between these two ropes?
One is thicker than the other.
One is made of nylon, and the other is made of natural fibre.
We use a plural form when we expect that there are (or may be) multiple differences.
Are there any differences between these pictures?
One has more people, fewer cars, and a cloudier sky than the other.
Are there any differences between these models of the same car?
One has air conditioning, a radio, and heated seats. The other does not, and is cheaper.
Comment: Thanks for the answer Michael! So for the same question, if the questioner is expecting only one difference, he can use "is there a difference". If he is expecting multiple differences, he can use "are there any differences", even if there is actually only one difference, right?
Comment: If the questioner is unsure which form to use, they can use either form.
Comment: Thank you! Btw, is *is there any difference between* correct? I noticed you are using *is there a difference...*. But I found a lot of "is there any difference" use cases in Google Books. https://www.google.com/search?tbm=bks&q=%22is%20there%20any%20difference%20between%22
Comment: You can use either.


How do I do pixel perfect collisions with cocos2d iphone

Question: I am making a space invaders clone on iPhone using Cocos2D v0.99. I am getting there with the framework but there is still a lot I don't know. The step I am stuck on comes down to collisions. I need to do two things:
1) I need to do a pixel perfect collision with the fleet of CCSprites that are animated using a spritesheet.
2) I need to do a similar pixelperfect collision with the bases but I also need to delete some pixels for the base.
I have found a few resources (http://groups.google.com/group/cocos2d-iphone-discuss/browse_thread/thread/f6e734e00d863f5e/41768952a1bcca0e?lnk=gst&q=image+mask) and tried to use CCMutableTexture2D but it doesn't work very well with this cocos2d version.
My approach at the moment is to try and fix CCMutableTexture2D but I am struggling to get the sprite texture data into the MutableTexture.
Is this the best way to be doing this or am I missing some other technique?
Thanks.
----- UPDATE -----
I managed to get this to work in the simulator using the color blend method here: http://www.cocos2d-iphone.org/forum/topic/18522
I also managed to use CCRenderTexture and a blend function to do the pixel deletion thing via the RenderMask class (rm below).
But... the collision detection fails on device. I think the masking works ok though. My best guess is that there is something that I am using that is not OpenGL ES (or I have not set something up correctly. My code is:
rt = [CCRenderTexture renderTextureWithWidth:480  height:320];
[rt beginWithClear:0 g:0 b:0 a:0];

[rm visit];

// Read pixels
ccColor4B *buffer = malloc( sizeof(ccColor4B) * numPixels );

glReadPixels(x, y, w, h, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
 [_rt end];

// loop through pixels
for(unsigned int i=0; i<numPixels; i++)
{
    ccColor4B color = buffer[i];

    if ((float)color.a >0) {
        [self doSomeStuff];
    }
}

So, is glReadPixels() supported in OpenGL ES? Or, is there some better way to do this?
// RenderMask.h
//
//  RenderMask.h
//

#import <UIKit/UIKit.h>
#import <stdlib.h>
#import "cocos2d.h"

@interface RenderMask : CCRenderTexture {
@public
NSMutableArray *sprites;
NSMutableArray *spriteMasks;
int currentSprite;
float frameInterval;    //How fast this animates
}

-(void) initArrays;
-(void) drawCurrent;
-(void) addSpriteMask: (CCSprite*)spriteMask;
-(void) addSprite: (CCSprite*)sprite;

@property(nonatomic, retain) NSMutableArray *sprites;
@property(nonatomic, retain) NSMutableArray *spriteMasks;
@property(readwrite, assign) int currentSprite;
@property(readwrite, assign) float frameInterval;

@end

// RenderMask.m
//
//  RenderMask.m
//

#import "RenderMask.h"
#import "CCActionInterval.h"

@implementation RenderMask

@synthesize sprites, spriteMasks, currentSprite, frameInterval;

-(void) initArrays {
    sprites = [[NSMutableArray alloc] init];
    spriteMasks = [[NSMutableArray alloc] init];
    currentSprite = 0;
    frameInterval = 0.1f;
}

-(void) drawCurrent {
    [self clear:0.0f g:0.0f b:0.0f a:0.0f];

    [self begin];
    //Limit drawing to the alpha channel

    NSValue *spriteValue = [sprites objectAtIndex:0];
    CCSprite *sprite = (CCSprite*)[spriteValue pointerValue];
    [sprite setOpacityModifyRGB:NO];
    [sprite visit];

    glColorMask(1.0f, 1.0f, 1.0f, 1.0f);

    NSLog(@"spriteMasks size: %u", [spriteMasks count]);

    for(NSValue *value in spriteMasks){
        CCSprite *spriteMask = (CCSprite*)[value pointerValue];
        [sprite setOpacityModifyRGB:NO];
        [spriteMask visit];
    }

    glColorMask(1.0f, 1.0f, 1.0f, 1.0f);
    [self end];
}

-(void) addSpriteMask: (CCSprite*)spriteMask {
    NSLog(@"Adding spriteMask!!!");
    [spriteMask retain];
    [spriteMasks addObject:[NSValue valueWithPointer:spriteMask] ];
}

-(void) addSprite: (CCSprite*)sprite {
    NSLog(@"Adding sprite!!!");
    [sprite retain];
    [sprites addObject:[NSValue valueWithPointer:sprite] ];
}

-(void) runAnimation {
    NSLog(@"running animation");
    [self drawCurrent];
    currentSprite = currentSprite + 1;
    if(currentSprite >= [sprites count]){
        currentSprite = 0;
    }

    CCActionInterval * runAction = [CCCallFunc actionWithTarget:self selector:@selector(runAnimation)];
    CCActionInterval * delayAndRunAction = [CCSequence actions:[CCDelayTime actionWithDuration:frameInterval], runAction, nil];
    [self runAction:delayAndRunAction];
}

@end

Also, there is a pretty serious performance issue with this code but I can probably work through that.
Thanks.
----- UPDATE (AGAIN) ------
I have a process partly working now where a data structure is build on base initialisation and used as a lookup for a collision. It was working 50%ish of the time but then crashing with an malloc EXC_BAD_ACCESS error until I turned on Zombies and all the various malloc debugging options in XCode. Now, I get a consistent crash on the line
CGContextClearRect(imageContext, CGRectMake(0, 0, contextWidth, contextHeight));

I get to this by doing (with a few lines missing for clarity):
CGImageRef image = [UIImage imageNamed:@"aspeaker.png"].CGImage;
imageContext = CGBitmapContextCreate(theData, width, height, 8, 4 * width,  CGColorSpaceCreateDeviceRGB(), kCGImageAlphaNoneSkipLast | kCGBitmapByteOrder32Big);
NSLog(@"imageContext: %@",imageContext);
CGContextClearRect(imageContext, CGRectMake(0, 0, width, height));
CGContextTranslateCTM(imageContext, 0, height - imageSize.height);
CGContextDrawImage(imageContext, CGRectMake(0, 0, CGImageGetWidth(image), CGImageGetHeight(image)), image);
CGContextRelease(imageContext);

The debug console says:
2011-09-12 10:49:07.753 Invaders[1341:c803] imageContext: <CGContext 0x7f798fa0>
Invaders(1341,0xad06c2c0) malloc: protecting edges
Invaders(1341,0xad06c2c0) malloc: recording malloc stacks to disk using standard recorder
Invaders(1341,0xad06c2c0) malloc: enabling scribbling to detect mods to free blocks

I have read a few things about being on the correct thread but it all looks like it is on thread 1.
Any ideas or a link to a good resource on how to debug malloc errors would be very gratefully received.
Thanks,
Martin
----- ANOTHER UPDATE -----
One thing that came out of Googling this is that there is some complexity in hooking up the OpenGL context properly (http://stackoverflow.com/questions/4459415/problem-with-opengles-to-show-an-image) I am just using the cocos2d 0.99 base so could this be the problem? If so how the *&%@£$ do I fix it?
Comment: Have you seen [this](http://stackoverflow.com/questions/1241023/pixel-perfect-collision)?
Comment: I did look at some CGImage type stuff but the problem is how to get from a texture to any kind of pixel data. CCMutableTexture2D seems to do this with pixelAt: but I can't figure out how to get from a CCTexture2D to a CCMutableTexture2D
Answer: I would suggest letting a physics engine handle the collisions, cocos2d integrates well with chipmunk and box2D, this engines can handle the collisions for you with callbacks.
Comment: Ok, well that's an option at least but they are pretty heavy so I'd rather do it directly if I can. Thanks.


How to boot into Sierra USB installer without Startup Manager?

Question: I'm trying to reinstall Mac OS on a late 2009 21.5 inch iMac. The previous owner tried to install ubuntu on it but failed to get it to work properly so I'm trying to install Mac OS Sierra from a USB stick. I know the USB works because I can boot from it on my Macbook Pro. The problem is that I can't figure out how to get the iMac to boot from the stick. Whenever I try to get into startup manager all I get is an all white screen and a mouse curser. I can get into Ubuntu safe mode and grub but I'm not sure what I can do from there to make the mac boot from USB.
Comment: I was going to suggest Internet Recovery but I don't think that model had that (Command-R at startup). How good are you with Ubuntu? There *may* be a way to image the USB key to a DVD, I wish I knew how, sorry. Perhaps a Linux guy could chime in and either call me an idiot or tell you how... But if you can download Sierra on a friend's mac and burn it to a DVD, you should be able to boot from that holding down the "C" or "D" key.
Comment: What keyboard shortcut are you using to get into the startup manager?
Comment: Are you holding Option while booting?
Comment: The first iMac with Internet recover is the Mid 2011, so you're right, that's not an option. Not sure why your USB isn't working, but it is possible there is an ubuntu bootloader in the way. The drive should show up if you boot with the option key held down.
Comment: @Allan I was holding down option/alt while booting, but that only took me into grub. I followed Tony's advice and reset the NVRAM and I was able to get into the installer.
Answer: I'm assuming that holding down the option key when starting up does not show the boot drive selector displaying at least your internal drive. If this is the case then there is another bootloader getting in the way.
Your next step should be to reset the NVRAM. You can find instructions here.
Comment: This worked! Now I just have to figure out how to reformat the internal hard drive so I can install High Sierra (I decided to make a new key with the latest OS), but that's another question.
Answer: The Mac probably has rEFIt installed, or it was uninstalled improperly. Try booting the computer off an original DVD and setting the startup disk. Or try booting with the option key and selecting your installer USB stick.
Comment: Unfortunately I don't have access to an original disk, so I can't follow this advice.


gcc arm executable "no such file orr directory", wrong dynamic lib

Question: I am trying to make a usable setup for gcc-linaro-arm-linux-gnueabihf-4.8-2013.11 on windows.
Something happens at dynamic link:
$(CC)-gcc   -o test main.c -Wall -lc

The program compiles fine, but when deployed to ARM shows:
"No such file or directory"
Searching the issue, seems that static build works but executable is huge:
$(CC)-gcc   -static -o test main.c -Wall -lc

Now I have a VisualGDB toolchain installed that builds (in IDE) with it's own toolchain a similar executable (small, dynamic) that works so I guess this is nothing wrong with my ARM distribution.
Am I missing something or wrong include from gcc-linaro-arm-linux-gnueabihf-4.8-2013.11 ?
Thanks very much in advance,
One more investigation:
file test

working (compiled with VisualGDB toolchain)
test: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, not stripped

mot working (compiled with gcc-linaro-arm-linux-gnueabihf-4.8-2013.11)
test: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 3.1.1, BuildID[sha1]=0x13accf06af902cd8b96d85b8a412e1d7822a302b, not stripped

my ARM
3.8.13

I run -readelf (for non working):
Dynamic section at offset 0x474 contains 24 entries:
  Tag        Type                         Name/Value
 0x00000001 (NEEDED)                     Shared library: [libc.so.6]
 0x0000000c (INIT)                       0x82a0
 0x0000000d (FINI)                       0x8434
 0x00000019 (INIT_ARRAY)                 0x10468
 0x0000001b (INIT_ARRAYSZ)               4 (bytes)
 0x0000001a (FINI_ARRAY)                 0x1046c
 0x0000001c (FINI_ARRAYSZ)               4 (bytes)
 0x00000004 (HASH)                       0x8194
 0x00000005 (STRTAB)                     0x820c
 0x00000006 (SYMTAB)                     0x81bc
 0x0000000a (STRSZ)                      65 (bytes)
 0x0000000b (SYMENT)                     16 (bytes)
 0x00000015 (DEBUG)                      0x0
 0x00000003 (PLTGOT)                     0x1055c
 0x00000002 (PLTRELSZ)                   32 (bytes)
 0x00000014 (PLTREL)                     REL
 0x00000017 (JMPREL)                     0x8280
 0x00000011 (REL)                        0x8278
 0x00000012 (RELSZ)                      8 (bytes)
 0x00000013 (RELENT)                     8 (bytes)
 0x6ffffffe (VERNEED)                    0x8258
 0x6fffffff (VERNEEDNUM)                 1
 0x6ffffff0 (VERSYM)                     0x824e
 0x00000000 (NULL)                       0x0

and working:
Dynamic section at offset 0x4d0 contains 24 entries:
  Tag        Type                         Name/Value
 0x00000001 (NEEDED)                     Shared library: [libc.so.6]
 0x0000000c (INIT)                       0x8274
 0x0000000d (FINI)                       0x8490
 0x00000019 (INIT_ARRAY)                 0x104c4
 0x0000001b (INIT_ARRAYSZ)               4 (bytes)
 0x0000001a (FINI_ARRAY)                 0x104c8
 0x0000001c (FINI_ARRAYSZ)               4 (bytes)
 0x00000004 (HASH)                       0x8168
 0x00000005 (STRTAB)                     0x81e0
 0x00000006 (SYMTAB)                     0x8190
 0x0000000a (STRSZ)                      65 (bytes)
 0x0000000b (SYMENT)                     16 (bytes)
 0x00000015 (DEBUG)                      0x0
 0x00000003 (PLTGOT)                     0x105b8
 0x00000002 (PLTRELSZ)                   32 (bytes)
 0x00000014 (PLTREL)                     REL
 0x00000017 (JMPREL)                     0x8254
 0x00000011 (REL)                        0x824c
 0x00000012 (RELSZ)                      8 (bytes)
 0x00000013 (RELENT)                     8 (bytes)
 0x6ffffffe (VERNEED)                    0x822c
 0x6fffffff (VERNEEDNUM)                 1
 0x6ffffff0 (VERSYM)                     0x8222
 0x00000000 (NULL)                       0x0

strace log:
execve("/usr/bin/test", ["test"], [/* 15 vars */]) = 0
brk(0)                                  = 0x17000
uname({sys="Linux", node="beaglebone", ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb6f8a000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=54751, ...}) = 0
mmap2(NULL, 54751, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb6f57000
close(3)                                = 0
open("/lib/libgcc_s.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0@\321\0\0004\0\0\0"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0644, st_size=1505830, ...}) = 0
mmap2(NULL, 152384, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb6f31000
mprotect(0xb6f4f000, 28672, PROT_NONE)  = 0
mmap2(0xb6f56000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1d) = 0                                                                                xb6f56000
close(3)                                = 0
open("/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\210\177\1\0004\0\0\0"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=1205468, ...}) = 0
mmap2(NULL, 1246600, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb6e00000
mprotect(0xb6f24000, 28672, PROT_NONE)  = 0
mmap2(0xb6f2b000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x123) =                                                                                0xb6f2b000
mmap2(0xb6f2e000, 9608, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb                                                                                6f2e000
close(3)                                = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb6f89000
set_tls(0xb6f896d0, 0xb6f89da8, 0xb6f8c058, 0xb6f896d0, 0xb6f8c058) = 0
mprotect(0xb6f2b000, 8192, PROT_READ)   = 0
mprotect(0xb6f8b000, 4096, PROT_READ)   = 0
munmap(0xb6f57000, 54751)               = 0
brk(0)                                  = 0x17000
brk(0x38000)                            = 0x38000
close(1)                                = 0
close(2)                                = 0
exit_group(1)                           = ?
+++ exited with 1 +++

Answer: I solved by myself, thanks for support anyhow.
The cross-compiler from Linaro links with a new lib name (some name changes in Debian) such as /lib/ld-linux-armhf.so.3 but the BBB (default) distribution use a old name /lib/ld-linux.so.3. Both names should point (symlinks) on BBB to real used library which is ld-2.16.so
So create another symlink and that's it.
ln -s /lib/ld-2.16.so /lib/ld-linux-armhf.so.3

-rwxr-xr-x 1 root root 130304 Mar 20  2013 /lib/ld-2.16.so
lrwxrwxrwx 1 root root     15 Dec 24 23:14 /lib/ld-linux-armhf.so.3 -> /lib/ld-2.16.so          <-- new one
lrwxrwxrwx 1 root root     10 Jun 19  2013 /lib/ld-linux.so.3 -> ld-2.16.so

Best regards and Merry Christmas to all,
Comment: Damn, I wasted hours on this, thanks.
For anyone with a similar problem on different toolchain, you can use the "strings" command to check for libs. (strings ~/development/test.elf | grep lib
/lib/ld-linux-armhf.so.3
libstdc++.so.6
libm.so.6
libgcc_s.so.1
libc.so.6
__libc_start_main)
Answer: It might well be a missing shared library on the deployment machine.
Try running $(CC)-readelf -d your-binary | grep NEEDED. This will display the names of the required shared libraries. Verify that they are present on the target machine
Try running ldd you-binary on the target machine. It should report what are the required
dynamic libraries and if they have been found.
PS. Run the program on the target with strace your-binary.  Look for open or access calls, which return error ENOENT.
Comment: strace see above (thank for pointing me, excellent tool) can you help me a bit to understand errors? Seems that /etc/ld.so.preload is missing (or my libc just included some symbols from there)
Comment: No, ld.so.preload is not strictly required. I can't see anything wrong in this strace output :(
Answer: The compiler uses the ld-linux-armhf.so.3 loader instead of ld-linux.so.3 if you pass the option mfloat-abi=hard to the linker by adding it to the LDFLAGS. No need for a symlink. At least it solved the issue for my Yocto Poky toolchain. See https://github.com/golang/go/issues/12443
Answer: I can think of the following as I had some similar issues before.
The arm distribution has the required libraries in a folder like /usr/lib or /lib in its distribution or some other folder and your compilation environment has these at a different location. If this is the case then either

setting the library path using ld_library_path environment variable (or .bashrc) may help
or creating the same folder structure as you have in your system may also help

I can see that your cross compilation does not take into account of any hardware specific libraries but it is just the new hardware's system libraries it is going to be dependent.
Ofcourse I am assuming that you have done a chmod to make your program an executable in your arm hardware or emulator.
Comment: I try to cross compile on windows for linux Angstrom and yes, I made +x :)


Standards of Evidence?

Question: What are the standards of evidence for an answer here? I know this isn't Skeptics, but I've seen several answers justified using intuitive "logic", without any citations. Should that be considered acceptable? What standards of evidence should we require for answers here?
Comment: Citations, however, don't necessarily validate 'intuitive logic'. It's politics, so this is always going to be an issue/question.
Comment: Doesn't that just mean we shouldn't use intuitive logic? I'm having trouble understanding your point.
Comment: I'm saying that citations alone aren't necessarily 'evidence'. Namely due to the fact that a lot of political analysis is opinion based to begin with. Point being that an answer with citations isn't going to necessarily be any better or worse than an answer that only uses intuitive "logic" without citations.
Comment: Well clearly the citations would have to be relevant, reputable, and substantiate the point the person is trying to make.
Comment: And therein lies the problem with politics. Is citing Rush Limbaugh relevant? Maybe. Reputable? debatable. It's always debatable. :)
Comment: Okay, but the reputability of sources is the same debate had on Skeptics, and that place still works.
Comment: I think intuitive logic makes a _fine_ answer, specially if anyone reading that answer can intuitively and clearly see the correctness of that logic. Good answers take some more, but sometimes they may be harder, they may imply writing an academic paper, that would be a really good answer, but the standards can be a bit lower here, IMHO.
Comment: They can be a bit lower, but a standard of intuitive logic isn't a standard at all. It allows anybody to use any justification for his argument.
Answer: I think we're better served by simply down-voting a question if you believe it to be wrong, otherwise this site is little more than a mechanical Turk for research.
You really only need an authoritative search in you answer if the question calls for one(maybe they're in a political discussion elsewhere, and need to bring sources with them)
But if someone's simply asking for a broader understanding on an issue, than a source isn't quite necessary.  It is very possible to describe an issue without proving it.
You can always down-vote an answer if it is wrong.
Comment: @Avi I think that's a good question and one the site is trying to figure out. Personally, I am seeing the site drifting into opinion-heavy territory so it may not survive the long haul.
Comment: Then that question should be removed if it cannot be answered constructively.
Comment: Then it's not clear to me what functions this site serves. I can find people's opinions out easily enough, what if I'm trying to determine a matter of fact?
Comment: That's exactly what I'm trying to avoid. I want to be able to ask a question about some quantifiable and observable political phenomenon and get answers linking to the evidence, not a rant about why that phenomenon is going to screw us all or something.
Comment: @Avi I'd like that too. But when I see a question trying to lead into a rant, I find that questioning that just turns into a giant debate. So I guess my hopes aren't too high.
Comment: @avi I agree. Or, at least, the offending part of the question should be removed. I think we're in the minority on that opinion at this time, however.

Standards of Evidence?


What is the best way to comunicate between two LWC that are not related and not on the same community page?

Question: I need to send data from one LWC to another on a community, both the lwcs are in a dedicated community page
Comment: Are you expecting the two community pages to be open in different browser windows (in the same browser session) at the same time, or are you trying to pass data from one page to another? If the latter you need to consider creating URLs that include query parameters from which the components fetch necessary information.
Answer: @Teemo_smr It seems you are looking for communication between different pages not on the same page. The below lines from the link seems to be able to do it.
Use a Lightning Message Channel (Beta)
To communicate between components within a single Lightning page or across multiple pages, you can use a Lightning message channel. The advantage of using a Lightning message channel over pubsub is that message channels are not restricted to a single page. Any component in a Lightning Experience application that listens for events on a message channel updates when it receives a message. It works between Lightning web components, Aura components, and Visualforce pages in any tab or in any pop-out window in Lightning Experience. It also works across namespaces. For more information, see Communicate Across the DOM with Lightning Message Service (Beta).
Answer: Communicating between two Lightning Web Components that are not contained in the same DOM tree can be done using the pubsub module that Salesforce has provided. This works familiarly to application events in Aura. Refer to the "Communicate Between Components" page in the LWC Dev Guide. Relevant excerpt:

Use the pubsub Module
  To communicate between components on a single page, you can use the pubsub module.
In a publish-subscribe pattern, one component publishes an event. Other components subscribe to receive and handle the event. Every component that subscribes to the event receives the event. For example, if you add two components to a Lightning page in Lightning App Builder, use the pubsub module to send events between them. The pubsub module restricts events to a single page.

In the doc Salesforce recommends copying the pubsub module from the lwc-recipes repo.
Code for pubsub.js below in case the GitHub repo disappears for any reason:
/**
 * A basic pub-sub mechanism for sibling component communication
 *
 * TODO - adopt standard flexipage sibling communication mechanism when it's available.
 */

const events = {};

/**
 * Confirm that two page references have the same attributes
 * @param {object} pageRef1 - The first page reference
 * @param {object} pageRef2 - The second page reference
 */
const samePageRef = (pageRef1, pageRef2) => {
    const obj1 = pageRef1.attributes;
    const obj2 = pageRef2.attributes;
    return Object.keys(obj1)
        .concat(Object.keys(obj2))
        .every((key) => {
            return obj1[key] === obj2[key];
        });
};

/**
 * Registers a callback for an event
 * @param {string} eventName - Name of the event to listen for.
 * @param {function} callback - Function to invoke when said event is fired.
 * @param {object} thisArg - The value to be passed as the this parameter to the callback function is bound.
 */
const registerListener = (eventName, callback, thisArg) => {
    // Checking that the listener has a pageRef property. We rely on that property for filtering purpose in fireEvent()
    if (!thisArg.pageRef) {
        throw new Error(
            'pubsub listeners need a "@wire(CurrentPageReference) pageRef" property'
        );
    }

    if (!events[eventName]) {
        events[eventName] = [];
    }
    const duplicate = events[eventName].find((listener) => {
        return listener.callback === callback && listener.thisArg === thisArg;
    });
    if (!duplicate) {
        events[eventName].push({ callback, thisArg });
    }
};

/**
 * Unregisters a callback for an event
 * @param {string} eventName - Name of the event to unregister from.
 * @param {function} callback - Function to unregister.
 * @param {object} thisArg - The value to be passed as the this parameter to the callback function is bound.
 */
const unregisterListener = (eventName, callback, thisArg) => {
    if (events[eventName]) {
        events[eventName] = events[eventName].filter(
            (listener) =>
                listener.callback !== callback || listener.thisArg !== thisArg
        );
    }
};

/**
 * Unregisters all event listeners bound to an object.
 * @param {object} thisArg - All the callbacks bound to this object will be removed.
 */
const unregisterAllListeners = (thisArg) => {
    Object.keys(events).forEach((eventName) => {
        events[eventName] = events[eventName].filter(
            (listener) => listener.thisArg !== thisArg
        );
    });
};

/**
 * Fires an event to listeners.
 * @param {object} pageRef - Reference of the page that represents the event scope.
 * @param {string} eventName - Name of the event to fire.
 * @param {*} payload - Payload of the event to fire.
 */
const fireEvent = (pageRef, eventName, payload) => {
    if (events[eventName]) {
        const listeners = events[eventName];
        listeners.forEach((listener) => {
            if (samePageRef(pageRef, listener.thisArg.pageRef)) {
                try {
                    listener.callback.call(listener.thisArg, payload);
                } catch (error) {
                    // fail silently
                }
            }
        });
    }
};

export {
    registerListener,
    unregisterListener,
    unregisterAllListeners,
    fireEvent
};

Comment: this is used only for components that are in the same page, I need to comunicate between component that are in different pages
Comment: Sorry for missing that. If that's the case Platform Events is likely the best way to have the two components react to events.
Comment: Worth also noting that pubsub doesn't work if the components are in different namespaces.


How to shout in Skyrim on the Switch?

Question: I have killed three dragons and it is equipped to my ZL button. Every time I press ZL, it just punches people though. What am I doing wrong? I'm trying to shout for the Greybeards and it won't let me. Please just give me step-by-step instructions.
Comment: Did you "equipped" the shout (judging by that situation I think you're trying to use Fus Ro Dah; Unrelenting Force)? You have to equip the shout at magic menu before using it.
Answer: Under the default controls, Dragon Shouts (and other Powers) are assigned to the R button.
zL is to use your off-hand (left hand weapon/spell, or block with shield)
zR is to use your main-hand (right hand weapon/spell)
Powers and Dragon Shouts do not count as normal Magic Spells; they do not use your hands to cast.
Answer: To add to this answer stating that you need to press the R button, you of course need to as well equip the shout you want to use in case you have not done this already.
The shout is equipped aside from your normal left and right-hand item and is because of that, linked to the R button.
I am mentioning this as this was my mistake in the past and know that the tutorial can be unclear.

Screenshot source: https://elderscrolls.fandom.com/wiki/Controls_(Skyrim)

How to shout in Skyrim on the Switch?


Minecraft Animation: My grass has black texture after render. How Do I Fix?

Question: For some reason when i render my scene in Blender my minecraft grass texture has a black background, not all the grass has the black background but most do and it is an annoyance. I just want to know how to fix it. I didn't change any settings, and I can't seem to find a solution anywhere after googling for an hour. There is a video how ever it is using Blender Render, and I am using Cycles.
Answer: It looks like your light bounces are low for that many transparent images.
Try increasing your transparency light bounces under
Properties > Render > Light Paths > Max Bounces > Transparency


How do you show that $d\theta = \frac{x dy - y dx }{x^2 + y^2}$?

Question: If $(r, \theta)$ are polar coordinates on $\mathbb{R}^2\setminus \{ (0,0)\}$, then how do I show/prove that
\begin{equation*}
d\theta =\dfrac{x dy - y dx}{x^2 + y^2}?
\end{equation*}
Comment: @Jyotirmoy: I have restored the [differential-geometry] tag because the *d* here may mean [differential form](http://en.wikipedia.org/wiki/Differential_form). @Jim please clarify if it is the case.
Comment: What set are you working on?  I don't think this makes much sense on R^2 as a whole.  Perhaps on R^2 - {0} this might work...
Comment: Well, since $\theta=\arctan\left(\frac{y}{x}\right)$, you can try implicit differentiation. Think of $\theta$, x, and y as a function of a new parameter, call it t, differentiate the whole mess with respect to t, and "cancel out" the $\mathrm{d}t$ term afterward.
Comment: Yes, I meant R^2-{0}
Answer: $$x=r\cos\theta$$
$$y=r\sin\theta$$
So,
$$dx=\cos\theta\thinspace dr -r\sin\theta\thinspace d\theta$$
$$dy=\sin\theta\thinspace dr +r\cos\theta\thinspace d\theta$$
Solving for $d\theta$ and using $\sin^2\theta+\cos^2\theta=1$
$$d\theta={{dy\thinspace\cos\theta-dx\thinspace\sin\theta}\over {r}}$$
Multiplying and dividing by $r$
$$={{dy\thinspace (r\cos\theta)-dx\thinspace (r\sin\theta)}\over {r^2}}$$
Using the definition of $x$ and $y$ in terms of polar coordinates
$$={{x\thinspace dy-y\thinspace dx}\over {x^2+y^2}}$$
Comment: Thank you so much, this was very helpful
Answer: On $R^2\setminus\{0\}$ we have $\theta=\Im(\ln(x+iy))$ (here $\Im$ stands for "the imaginary part of"). Therefore $$d\theta = \Im\left(\frac1{x+iy}\right)dx+\Im\left(\frac{i}{x+iy}\right)dy=\Im\left(\frac{x-iy}{x^2+y^2}\right)dx+\Im\left(\frac{i(x-iy)}{x^2+y^2}\right)dy=$$$$\frac{-y}{x^2+y^2}dx+\frac{x}{x^2+y^2}dy=\frac{xdy-ydx}{x^2+y^2}.$$
Answer: First you need a definition of $\theta$ (and/or $d \theta$) to compare with the form involving $dx$ and $dy$.    In coordinates any definition is only "local" and limited to regions of $(x,y)$ that exclude loops around $0$ (which would modify $\theta$ by $2\pi$).  In practice any local definition will be as a function of $x/y$ or of $y/x$ according to which line or half-line from $0$ is excluded as a "branch cut".  e.g., $\theta = \arctan(y/x)$.
If $\theta$ is defined using trigonometric functions one then needs a definition of those functions not using angles, or the whole exercise is logically vacuous, defining $\theta$ in terms of $\theta$ (using polar coordinates is an example of this).  An angle-free definition is possible but it is ad hoc if there is no clear relation to geometry, such as defining inverse sine or tangent functions as integrals.  A more "correct" definition is to use arc length on the projection of $(x,y)$ to the unit circle.  Here if $u(x,y)=(x,y)/\sqrt{x^2+y^2}$ is the projection one would have $d\theta = |u(x+dx,y+dy) - u(x,y)|$ up to second order terms in $dx$ and $dy$.


URl to record page in Salesforce1

Question: Hi I'm using jQuery mobile to render records and on each link I want to just redirect to the record view page. I'm using sforce.one.navigateToSObject on the href attribute, which works fine. But when I click on the back arrow on the record page, it takes me back to the home page of the lightning app, instead of the custom page that displays the records. Any ideas?
Answer: You'll want to look at the Managing Navigation Section of the Salesforce1 Mobile App Developer Guide, particularly Navigation with the sforce.one Object.Tthe back button works differently in Salesforce1 than in the standard platform from a regular browser. Your code will need to be adjusted to take this into account.
As an example, here's what it says about back([refresh]) navigation:

Navigates to the previous state that's saved in the sforce.one history. It's equivalent to clicking a browser's Back button.
refresh is optional. By default, the page doesn't refresh. Pass true to refresh the page if possible.

Now, you're using navigateToSObject(recordId[, view]) to get to a Lightning Page. Here's what it says about that command:

Navigates to an sObject record, specified by recordId. This record "home" has several views, which in Salesforce1 are available as slides that the user can swipe between.
view is optional and defaults to detail. view specifies the slide within record home to display initially. The possible values are as follows.

detail: the record detail slide
chatter: the Chatter slide
related: the view of related slide

Okay, you're probably wondering why I'm telling you all this. The reason being that the above command is obviously intended for use to get to a standard Object view and was never intended to get to a Lightning page to view an Object record.
If you look at how Lightning Components are being implemented on the platform, they're being implemented via Actions. If you use an Action to get to your Object view I strongly suspect your back button will return you to your previous view on the Lightning page.
Comment: Thanks. The VF page with the urls pointing to the record page via navigateToSObject is actually opened from an action on the lightning page.  So navigateToSObject takes to the record view page, the back button on the record view page supposedly should take back to the lightning page, but it's not. It's going back to the Salesforce1 home page.
Comment: When you say "Action" do you mean a Lightning Event Action or do you mean a " Custom Salesforce Global or Object Action"?  If the former, we're not talking about the same thing and I'd ask how you were implementing it? If the latter, then we're on the same page and I'd recommend you file a case with Salesforce Support.

URl to record page in Salesforce1


Is there any way to trace optimizer's work in DB2?

Question: Just like the MEMO structure in SQL Server which is kind of a "paper trail" of steps the optimizer takes in optimizing the query, is there anything in DB2 through which I can get the information like, which plans the optimizer considers, the cost of each plan?
Answer: I don't know of a way to trace all the plans the optimizer considers. Obviously the EXPLAIN statement gives you the plan the optimizer eventually selects (and the re-written statement), but that doesn't tell you anything about the ones it doesn't select.
One way to get a little more info might be to set CURRENT QUERY OPTIMIZATION to different values (the default is 5), run EXPLAIN on the statement, then set it back to the default (5) and run EXPLAIN again.
If you get different plans with the other optimization levels, this may provide a clue as to the paths DB2 is taking in optimizing your statement (of course, if you get the same plan, it doesn't tell you anything!). I would suspect that the simpler the query the more likely you are to find no difference (so conversely this technique would work better with more complex statements).
Comment: For a complex or even moderate complex statement I assume there is huge number of plans considered (most of them poor). For educational purposes it would be rather cool though to be able to save them in copies of the explain tables and be able to examine them with say db2exfmt --rejected_plans or similar
Comment: It would be fascinating. More than any engine I've worked with, DB2 spends its time planning but often with excellent results (I recall one horrifically complex set of views denormalising about 20 tables with about 60 joins - DB2 spent 3 of the 4 minutes of execution time planning ... but that meant everything ran in 1 minute!)


Gradient along the surface of a helical spiral

Question: I want to create a gradient that spirals along with the helical structure like in the figure attached. However I cannot seem to get the gradient curving the right way. I have tried turning several knobs to no avail as shown in the screenshot. Any assistance will be appreciated.
Answer: If you want to use object coordinates (and considering the object origin is at the center), you can't do it with a mapping alone as it will not allow to start at the inner radius of the helicoid in all directions.
Instead you can:
Keep only X and Z as the helicoid is along Y.
Get the length, which goes from the inner radius to the outer radius.
Remap the length from min (the inner radius) and from max (the outer radius) to 0 and 1.

If you've made the shape with a screw modifier, use UV stretch:

And keep only the Y value from the UV coordinates:
Comment: Thank you very much for the solid advice. This does the trick magnificently
Answer: You can use the UV of the object: make one orthogonal face of your spiral object active (or in the UV Editor make one face orthogonal and make it active) and Unwrap > Follow Active Quads:

In the Texture Coordinate node choose the UV output, in the Mapping node tweak the Location and Rotation values, plug it into a Texture > Gradient node:
Comment: That is an cool way of looking doing this. Also add the mesh lines like the original image. Thanks a ton!


Are all planes painted white first?

Question: Is white used as base paint before other colors? So is the paint on coloured parts thicker than in white parts?
Answer: Not always.  This video (screenshot below) shows an ex-US-Airways A319 being redecorated in the American fashion.  While the blue and red paint for the tail detailing is indeed applied on top of a white undercoat, the blue and red paint for the detailing on the mid-to-forward fuselage is applied directly on top of the yellow primer coat, with no white undercoat; the coat of white paint on these parts of the fuselage goes on top of the other colors.

That said, some browsing through airliner-painting videos gives the impression that, although a white undercoat isn't universal, it does seem to be surprisingly common, even for liveries that otherwise have little or no white.

Are all planes painted white first?


A good way to debug nullPointerException

Question: I am using eclipse and programing in java. Sometimes I come across a nullPointerException that will plague me for hours. Is there anyway to debug nullPointerExceptions better and figure out what variable values are and other things that would cause null Pointer Exceptions.
Comment: look at the stack trace... it shows what line threw the NPE and you can put a break point there and see what variable is null...
Comment: You could place `assert` statements into your code
Comment: Doesn't the exception tell you what line had the error?  Any given line of code shouldn't be doing a whole lot, and any given function should ideally only have a few lines of code (or otherwise be very simple even if it has many lines).  It shouldn't be hard to identify where the null value originated in any given function.
Comment: The best way to learn how to debug NPE is to keep debugging them. You will get better at it with time. But the key is to find out where it's occurring and then check the variables. No magic here.
Comment: Uh, look at the exception trace and see where the error is raised.  Put a stop there (or insert print statements) to figure out what value is null.  Trace that value back to its source.
Comment: My problem is that with a function like function(a, b, c, d, e) it does not tell you which one of those variables is null.
Comment: @NoahHuppert: makes no sense. The stack trace will tell you the line of the NPE, and your debugger or logger or println will tell you which reference variable is null.
Comment: @HovercraftFullOfEels I was asking if there was any debugger or logger that would help me.
Comment: @NoahHuppert: **any** debugger or logger will help you. Just give them a try. But again, there is no magic, you just have to trace the NPE to its source.
Answer: Look at the stack trace and read the line number where the NullPointerException is thrown. Almost always, the line has some method invocation like
x.getValue()

If x is null, you get a NullPointerException. If the method at the top of the stack trace is not your code, trace the stack all the way back until you do reach your code. Very often in this case, you are passing null to a method that doesn't like null parameters. Find it and fix it.
Also, very often when you encounter a method that is not yours that is throwing a NullPointerException, read the documentation. For example, look at String.replace(CharSequence target, CharSequence replacement):

Throws:
NullPointerException - if target or replacement is null.

It doesn't get much clearer than that!
Here's an example:

Looking at line 4, we see foo.bar(). This implies that foo is null. That one is easy. Let's look at another example:

Tracing back to your code, we see that s.replace(target, replacement) is throwing. We should inspect target and replacement. Let's attach a debugger:

Aha! replacement is null. You can do the same thing in Eclipse. Set a breakpoint for when an exception is thrown, and use it to inspect the parameters to your method. I'm primitive here because I come from a school of thought where I genuinely believe everyone would be better off if they learned to do it the hard way first. Leaky abstractions and all that.
Comment: An example or a screenshot with freehanded circles would be nice :)
Comment: My problem is that with a function like function(a, b, c, d, e) it does not tell you which one of those variables is null.
Comment: @hexafraction: or even better, 8x10 in glossy pictures with circles and arrows and a paragraph on the back of each one explaining what each one was to be used.
Comment: @HovercraftFullOfEels - You forgot the dog smelling prints.
Comment: @HovercraftFullOfEels I had some of those but Jason walked in with a seeing eye dog.
Answer:
While debugging can you use the BreakPoints view, to capture the null
pointers.

Window -> Show View -> Breakpoints

In the view there is a "J!" that lets you set breakpoints on
exceptions. You can set java.lang.NullPointerException. So once
null pointer exception is thrown, you can check which variable is causing
null.
Other thing you can do is capture possible null pointer access while you are coding. Off-course you cant capture all the Null Pointers using this setting. But still its helpful, set the following settings in your eclipse.

Preferences -> Java -> Compiler -> Errors/warnings -> Null analysis
Comment: It may also be a debug setting in eclipse that is halting program execution on uncaught exceptions. See answer: https://stackoverflow.com/a/32606736/2544255
Answer: There are a few ways to make NullPointerException less of an issue:

Use the @Nullable annotation.
Test the values of arguments for null in constructors and setters (avoid setters in plain old Java code). If you do this a lot you could make an (Eclipse) source code template to quickly generate the code. This is called "failfast" - you don't wait for the exception to be thrown when the value is being used further in the code, e.g. after storing it in a field.
Make sure that you perform a minimum amount (e.g. 1 or 2) of operations per line. If you don't you will have to find out where in the single line expression the NullPointerException occurred.
Don't use null in fields to indicate state. Instead, use e.g. an enum State. E.g. don't do if (socket == null) { // not connected } as it easy to forget to check for null later on. A explicit state is not so easy to forget.
Don't initialize local variables to null unless explicitly needed. Actually, if you handle your scope and exceptions correctly you should be able to mark most variables final. Replacing the default printStacktrace() methods with throw new IllegalStateException("Unhandled program state", e) helps because it is seen as an exit point of a code block.

After a lot of programming you will find the number of NullPointerExceptions go down.