How to disable OTP Captcha in android studio

Question: I'm working on a Google sign in that sends an OTP to a phone number, however when I update the dependencies, a captcha appears. How can I get rid of it?
All methods are implemented by myself.
Using the Google Console, you can enable your Android Device Verification.
in firebase, add sha-256 and SHA-1 Also Add playconsole sha-1 and sha 256 as well.
However, the captcha is still not removed.
Is there anyone who can assist me with this?
here is dependencies
 implementation 'com.google.firebase:firebase-inappmessaging-display:20.1.1'
 implementation 'com.google.firebase:firebase-analytics:20.0.0'
 implementation 'com.google.android.gms:play-services-ads:20.4.0'
 implementation 'com.toptoche.searchablespinner:searchablespinnerlibrary:1.3.1'
 implementation 'com.facebook.android:facebook-share:12.1.0'
 implementation 'com.google.firebase:firebase-crashlytics'
 implementation 'com.google.firebase:firebase-analytics'
 implementation platform('com.google.firebase:firebase-bom:29.0.0')
 implementation 'androidx.browser:browser:1.2.0'
 implementation 'com.google.android.gms:play-services-safetynet:17.0.1'

these all dependencies i am using
google play services dependencies are
 implementation 'com.google.android.gms:play-services-maps:18.0.0'
implementation 'com.google.android.gms:play-services-location:18.0.0'
implementation 'com.google.android.gms:play-services-auth:19.2.0'

I also implement all methods that are answer in stackoverflow
follow this link
Here is my gradebuild file
 dependencies {
    classpath 'com.android.tools.build:gradle:4.2.2'
    classpath 'com.google.gms:google-services:4.3.10'
    classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.0'

}

Answer:
Go to the settings in Firebase,

Click on App Check,

Click on the package name,

Enable safetyname,

Save.

This should work if you implemented all methods.
Use release Sha-1 and Sha-256.
Enable Android device verification from the Google Console.
Comment: Solved thanks th9i step is remaining :) save my day


Devise: Custom fallback function for authenticate_user

Question: I want to write a function which sets cookie when user is not authenticated. So after authenticate_user! if user is not authenticated the cookie is set. Can this be done in devise.
I tried doing it by customizing authenticate_user! function, but can't find anything.
Thanks
Answer: Are you using before_filter to call authenticate_user!? Can't you just do:
before_filter do
  authenticate_user!
  your_cookie_method if current_user.nil?
end

Comment: I am using it in many engines, so ihave to make these changes in controller of all the engines, which is not good, i want to make change to authenticate_user function of devise


How is the shrinkwrap file generated?

Question: When locking down node modules using shrinkwrap, how is the npm-shrinkwrap.json file generated? Does it recursively check node_modules folder and get it's info there?
I'm asking because I did a npm install successfully behind a proxy which translated github repo's to an internal artifactory repo, but the generated shrinkwrap contains urls directly to github (what I don't want)
Comment: If the proxy is doing "magical" substitution of those repositories for you, then i would guess that shrinkwrap has no way to deduce the "real" repo urls, but of course they would still work as long as you're behind the proxy?

Concerning your actual question, i think it does what you describe by default but not 100% sure.. Is it not described in the documentation?
Answer: write npm shrinkwrap in your terminal folder which contains package.json file which will genrate npm-shrinkwrap.json file
Ya this will check recursively in your node module folder of directory.

How is the shrinkwrap file generated?


What is rss category format in manage dislay?

Question: Anybody please explain what is the rss-category format, in the manage display settings of term referense field.

When I check this format, nothing is displayed on the node page.
Thanks.
Comment: check this may help you http://drupal.stackexchange.com/questions/46009/how-to-make-drupal-7-render-taxonomy-tags-as-rss-categories
Comment: Thank you.I read this post, but I still not understand, where I can see it in action.
Answer: This display setting hides taxonomy links on the node page and adds category elements into Drupal's RSS feed (http://example.com/rss.xml). Go to your site's RSS feed and you can see it in action.


Laravel form input integer length

Question: In Laravel form input validation, you can specify a minimum and a maximum length of a given input field.
$inputRules = [
    'postCode' => 'min:3|max:8'
];

Validation outcome

'BA45TZ' = true
'FF'     = false
'GH22 55XYZ' = false

However if I do the same for a number, it will validate whether the input is less than or greater than the input, then return on that.
$inputRules = [
    'cv2' => 'min:3|max:4'
];

Validation outcome

'586' = false
'4'     = true
'2' = false
'3' = true

I actually want to validate a numbers length not it's numerical value. I can't figure out how to do this. Google has been no help, or I am not searching the right thing.
Anybody had any experience with this?
EDIT: I have answered my own question. I had missed Laravels digits_between.
Answer: Like an idiot, I missed Laravels digits_between validator rule. I swear I had scoured those rules, but here we are.
Thank you everyone for your help.
$inputRules = [
    'cv2' => 'required|numeric|digits_between:3,4'
];

Comment: Wow didn't know this one. So I guess I'm an idiot too :P Just note that you won't be able to use this for only min or max.
Comment: If you didn't know you can accept your own answer. However, you have to wait 48 hours to do so.
Answer: That's the expected behavior of Laravel's size, min and max validations. You can't change it.

For string data, value corresponds to the number of characters. For numeric data, value corresponds to a given integer value. For files, size corresponds to the file size in kilobytes.

To solve this you have to create a custom validation rule.
Something like this:
Validator::extend('min_length', function($attribute, $value, $parameters){
    return strlen($value) >= $parameters[0];
});

Validator::extend('max_length', function($attribute, $value, $parameters){
    return strlen($value) <= $parameters[0];
});

And you can use them in the same way:
'cv2' => 'min_length:3|max_length:4'

Comment: This is the exact thing I was looking for, I'll be damned if I could find this anywhere else. Thanks buddy.

Is there a preferred place to put this? I would rather not have it in the method that I am using to validate.
Comment: The preferred place to register this (especially in Laravel 5) would be a service provider.
Comment: @lukasgeiter I'm sorry, where should I put this code? I'm looking for best practices and this is what I was looking for
Comment: @ggderas As I said in my previous comment, this should go into a service provider. You can find a section about them in the documentation...
Answer: For length in number you've to use size, but you can't put ranges in it. So, the best thing to do is making a custom validation.
Here is the documentation in laravel: http://laravel.com/docs/5.0/validation#custom-validation-rules
And an example:
Validator::extend('minsize', function($attribute, $value, $parameters)
{
    return  strlen($value) >= $parameters[0];
});

And do the same with maxsize.

Laravel form input integer length


Fedora - Configuring as a Xen Host (EFI preferable)

Question: I've got a new Fedora box that I'm setting up as a Xen host (Dom0), which is proving a little more difficult than expected.
First stop - install Xen via DNF and reboot. Find that the Xen boot option fails (lots of errors about multiboot). After a bit of googling I learn that this is because multiboot has been stripped out due to security concerns.[1]
Ok - well that's annoying. Looks like I have two options [2]:

Manually reconfigure GRUB to use the older Chain Loader behaviour
Bypass GRUB and use Xen as the EFI bootloader

I'm going for option 2, since this seems like a cleaner solution and doesn't require wrangling the layers of shell scripts that have built up around GRUB these days to make it do what I want.
I've gotten as far as creating an EFI boot option for Xen, but it appears to get silently skipped on start up. No errors, no useful output. I'm not sure what to check next.
What I've got so far:
EFI partition has EFI/xen with:

xen.efi (copy of EFI/fedora/xen-4.11.1.efi)
Copies of initramfs & vmlinuz from /boot
xen.cfg

xen.cfg text:
<code>[global]
default=fedora

[fedora]
options=
kernel=vmlinuz root=/dev/nvme0n1p1 rhgb LANG=en_GB.UTF-8
ramdisk=initramfs.img
</code>
EFI option created using:
<code>efibootmgr -c -L Xen -d /dev/sdc -p 1 -l \\EFI\\xen\\xen.efi -c
</code>
Target state here is: Machine booting with Xen and a Fedora Dom0. What should I check, or what should I try next?
[1] https://access.redhat.com/security/cve/cve-2015-5281
[2] https://wiki.xenproject.org/wiki/Xen_EFI
Comment: Just curious: why Xen and not KVM?
Comment: I'm planning to go with paravirtualized VMs (no need to emulate any kind of hardware, so closer to the metal and a little more efficient).
Comment: I'm not sure that's an up-to-date assessment. See [this from 2015](https://blog.linode.com/2015/06/16/linode-turns-12-heres-some-kvm/), even.
Answer: Ok, so as it turns out my efibootmgr command was correct (must've been a typo the first time I typed it).
That got me as far as booting the kernel, but the stock Fedora kernel kept suffering from a kernel oops at start-up (which was resolved via a kernel update).
And the Xen Dom0 is then up and running.


George Boolos and Gödel's Second Incompleteness Theorem

Question: In Mind, Vol. 103, January 1994, pp. 1-3, George Boolos wrote:

And so on. In fact, if a claim can be proved, then it can be proved
  that the claim can be proved. And that too can be proved.
Now, two plus two is not five. And it can be proved that two plus two
  is not five. And it can be proved that it can be proved that two plus
  two is not five, and so on.
Thus: it can be proved that two plus two is not five. Can it be proved
  as well that two plus two is five? It would be a real blow to math, to
  say the least, if it could. If it could be proved that two plus two is
  five, then it could be proved that five is not five, and then there
  would be no claim that could not be proved, and math would be a lot of
  bunk.
So, we now want to ask, can it be proved that it can't be proved that two plus two is five? Here's the shock: no, it can't. Or, to
  hedge a bit: if it can be proved that it can't be proved that two plus
  two is five, then it can be proved as well that two plus two is five,
  and math is a lot of bunk. In fact, if math is not a lot of bunk, then
  no claim of the form "claim X can't be proved" can be proved.

...and...

...yes, it can be proved that if it can be proved that it can't be proved that two plus two is five, then it can be proved that two plus two is five. [i.e. what's asserted above can be proved]

[parentheticals added by me]
Please excuse the potentially ignorant questions:

Why proving that two plus two is four does not constitute as a proof that two plus two cannot be five (thus cannot be proved as such)?
Should I understand that the only way to prove that it cannot be proved that two plus two cannot make five is to prove that the system within we work is consistent, and that there is no other way? (If so, what is the proof that there is no other way?)
Answer: While $2+2=4$ seems like an easy target for a way to prove $2+2\neq 5$, you're implicitly assuming that $4\neq 5$ and that $4=5$ cannot be proved. But if arithmetic is inconsistent, you can prove that $4=5$, in which case $2+2=5$ as well.
So stating that $2+2=5$ is not provable is a way of saying that $0=1$ is not provable. But now recall that the standard formulation of $\operatorname{Con}(T)$ is "$T$ does not prove $0=1$".
To your second question, the answer is more subtle than that. You need to assume that the system you work in is consistent, but that's why we have a meta-theory. Set theory proves that arithmetic is consistent, so working inside set theory you can prove that $2+2=5$ is not provable from the axioms of arithmetic. Of course, now you might want to ask, could set theory prove that $2+2=5$ is impossible? And Gödel snarks in the corner and says "try again". So you have to move to a stronger theory, and so on and so forth.
It's turtles all the way down.
Comment: What's the distinction between `proving that 2+2=5 is not provable from the axioms of arithmetic` and `proving that 2+2=5 is impossible`?
Comment: Well, "impossible" has an implicit (and thus vague) context.
Answer:
Why proving that two plus two is four does not constitute as a proof that two plus two cannot be five (thus cannot be proved as such)?

A proof that $2+2=4$ does indeed constitute a proof that $2+2\neq 5$ (assuming you can also prove that $4\neq 5$, which presumably your system of mathematics is strong enough to do).  The problem is in your final parenthetical.  Just because we can prove that $2+2\neq 5$ does not mean that no proof of $2+2=5$ exists.  Maybe there exist proofs of false statements!

Should I understand that the only way to prove that it cannot be proved that two plus two cannot make five is to prove that the system within we work is consistent, and that there is no other way? (If so, what is the proof that there is no other way?)

Well, it's not so much that there is no other way, but rather that the two statements are basically identical.  If the system in which we work were inconsistent, then it could prove everything, since anything follows from a contradiction.  So if we prove that our system cannot prove $2+2=5$ (or any other statement), that would in itself immediately prove that our system is consistent.  Conversely, if we prove our system is consistent, then we conclude that it cannot prove that $2+2=5$ (since if it could, our system would prove a contradiction since we can also prove that our system proves $2+2\neq 5$).  So proving that our system cannot prove $2+2= 5$ is essentially the same thing as proving that our system is consistent.
Comment: @blackened Ultimately that depends on the definition of "only way". To me, and apparently to Eric as well, a good way to define "the only way to prove X is proving Y" is that whatever proves X proves Y automatically (and in this case, you can even require the converse as well - that whatever proves Y proves X automatically - and it still works for this question). Assuming this definition of "only way", Eric proved in his answer that proving consistency is indeed the only way, because he showed that proving X proves Y and vice-versa (where X is 2+2=5 and Y is consistency).
Comment: If $4=5$, then $2+2=4$ *does not* constitutes a proof that $2+2\neq 5$. All you do is dress the problem in a different hat, and claim it's a different problem.
Comment: @AsafKaragila: Right, but I never claimed that you can't prove $4=5$.  I only claimed that you _can_ go from a proof of $2+2=4$ to a proof of $2+2\neq 5$ (which is because you can also prove that $4\neq 5$).
Comment: @Eric Obviously, proving the consistency of the system solves the problem. I just do not see how your argument proves that proving the consistency of the system is *the only way to prove that* it cannot be proved that two plus two is five. What is the proof of that statement?
Comment: @AsafKaragila: OK, but any reasonable system of mathematics can also prove that $4\neq 5$. This together with $2+2=4$ _does_ prove that $2+2\neq 5$.  (Of course, this still doesn't mean that you can't also prove $2+2=5$, and that $4=5$.)
Comment: Eric, of course, yes. But the whole point of the second incompleteness theorem is that you need to step *outside* of your system in order to prove that it *doesn't prove* $4=5$.
Comment: There's one thing I feel is missing from this answer: a mention of how a proof of $2+2=5$ (and equivalently that the system is consistent) cannot occur *within* the same system. This seems to be Boolos' point, but it's good to mention it explicitly.
Answer:
From a proof of $2 + 2 = 4$ it follows a proof of $2 + 2 \neq 5$, but it does not follow that the system cannot prove $2 + 2 = 5$  because if the system is not consistent, then the system can prove everything according to the principle of explosion, in particular for every statement $A$ the system can prove $A$ and its negation $\lnot A$.
As a consequence, the only way to be sure that $2 + 2 = 5$ cannot be proved in the system is the fact that the system is consistent. According to the principle of explosion, to prove$-$in the meta-theory$-$that the system is consistent it is enough to show that there is a formula that the system cannot prove.

Gödel's second incompleteness theorem claims that for any consistent and computable axiomatic system  $S$ that is powerful enough to describe the arithmetic of the natural numbers (e.g., the Peano axioms or Zermelo–Fraenkel set theory with the axiom of choice), the consistency of $S$ cannot be proved within $S$ itself. This means that:

in $S$ it is possible to canonically define a formula $Cons(S)$ expressing the consistency of $S$; typically, $Cons(S)$ states "there is no natural number that codes a derivation of '$0=1$' in $S$";
$S \not\vdash Cons(S)$, that is, there is no derivation of $Cons(S)$ in $S$; this is enough to prove that $S$ is consistent in the meta-theory, but it means that you cannot prove the consistency of $S$ within $S$.

Of course, you can prove the consistency of $S$ in a stronger system $S'$ containing $S$, but if $S'$ is consistent then the you cannot prove the consistency of $S'$ within $S'$ (or within $S$).
Comment: Your first claim is false. "2+2≠5" is abbreviation for "¬(2+2=5)" which can be proven from "2+2=4". The principle of explosion has nothing to do with this.
Comment: @user21820 - Of course, "$2+2\neq 5$" is abbreviation for "$\lnot (2+2=5)$". But the fact that you can prove that $2+2 = 4$ is not enough to conclude that you can prove that $2+2 \neq 5$. Indeed, if your system is inconsistent, then you can prove whatever you want, in particular $2+2=5$ (and $2+2 \neq 5$) as well. If you _assume_ that your system is consistent, then a proof of $2+2=4$ implies a proof of $2+2 \neq 5$.
Comment: @Taroccoesbrocco: Look you are simply wrong about that. By your own words in your last comment, what I stated is perfectly correct, since if the system is inconsistent then you can prove "2+2≠5" from "2+2=4", exactly as I claimed.
Comment: @user21820 - You are totally right, thank you! What a mistake! I'm still in holiday... I fixed the sentence.
Comment: Hello, I did not downvote, but upvoted. Great answer. I'd like to ask for some clarification by the way (I'm new to all these Godel stuff): According to your second bullet, Godel's theorem implies that there is no way to start from the axioms of ZFC and conclude Con(S), right? In other words, none of the countably infinite proofs that can exist in ZFC is a proof of Con(S), right? And what I just said is not a proof of Con(S) within S because in my reasoning I used Godel's Theorem, which does not follow from S alone, right?
Comment: @Taroccoesbrocco: Okay thanks for fixing and enjoy the rest of your holiday! =)
Comment: @PedroA - Thank you! I'm not sure what $S$ refers to in your argument. I can reformulate your argument in this way: Gödel's second incomleteness theorem implies that there is no way to start from the axioms of ZFC and conclude $Cons(\text{ZFC})$. In other words, none of the countably infinite proofs that can exist in ZFC is a proof of $Cons(\text{ZFC})$. But in ZFC there is a proof of $Cons(\text{PA})$ (where PA is the set of axioms of Peano arithmetic). The point is: how can we be sure that ZFC is consistent?


Why are modules showing up as themes?

Question: I am uploading my Drupal Commerce Kickstart website to the host from my local computer, and I seem to be facing issues at every turn. I have not edited any of the code (trying to avoid it) or moved around any folders except in themes so it's likely something to do with that.
It does not seem to be affecting the functionality of the website but clearly I've moved (or not properly uploaded via FTP) something important. I searched through as best I could and haven't found anyone else who has broken Drupal like this so I'm feeling pretty special.
Why are modules showing up as themes?
Comment: Can you show a tree of your sites folder?
Comment: I think we'll need a bit more details on your problem to be able to help. When you say your modules are showing up as themes, what do you mean?
Comment: I mean quite literally my Module list is duplicated in my Appearance panel as if they are all installed themes! Here is a screenshot: http://i62.tinypic.com/svt2cw.jpg
Answer: Drupal uses a function called _system_rebuild_theme_data() to help determine the list of themes (both enabled and disabled) to show on that page. That function does a number of things, but the first thing it does is to look for any .info files within the "themes" directories, which can include /themes, /sites/all/themes, sites/anydirectory/themes.
So, based on the screenshot, it appears that you have some modules placed in a themes directory. I would go through your themes directories to make sure that that isn't the case.
Comment: Bingo. Stemming from the bizarre organization of Commerce Kickstart. I upgraded and broke everything, but was able to fix by moving the kickstart theme into the sites folder - Kickstart is nice for a fast build but not the most friendly for upgrades, it seems... This is awesome though, thank you!

Why are modules showing up as themes?


C - effect of a write() to a closed tcp connection when using signal(SIGPIPE, SIG_IGN);

Question: By closed connection I mean that the other end closed it gracefully.
I would expect to receive a 0 from the write() as returned value, but please correct me if I am wrong.
Answer: Exact behavior may depend on underlying OS but in general you should get an error, i.e., write will return -1 and set errno (to ECONNRESET for instance).
Comment: I just tested it on my linux machine, and it returns a value > 0 ! (ie the number of characters it thinks it wrote)
Comment: It's normal to be able to write at least once more; and you can get even more in some cases.  On an old BSD system, connecting just to my own local machine, I get one successful write followed by a -1 with errno set to `EPIPE`.  On a more modern Linux box I get the same thing.  This is because it takes one extra TCP round-trip for the sender to "see" that the receiver has gone away.  Setting `SO_KEEPALIVE` should cause an earlier discovery but it can take a long time (RFC-1122 says at least 2 hours!).


Array push só funciona dentro do callback

Question: Estou tentando atualizar um array com valores retornados pelo mongoose. Mas o array retorna vazio. Segue o trecho do código:
let y = [];
Vendas.countDocuments(
  { dt_encerramento: { $gte: jan, $lte: abr }},
    function(err, os) {
      y.push(os);
    }
  );

Se dou console.log(y) dentro do callback, tenho os valores. Se executo logo após o countDocuments, me retorna um array vazio.
Alguém saberia dizer o que estou fazendo errado?
Answer: Isso acontece por conta de problemas com o caráter assíncrono do callback. Nesse caso, você deve usar promises em conjunto com async/await:
async countDoucments() {
   const numeroDeDocumentos = await Vendas.count({ dt_encerramento: { $gte: jan, $lte: abr }}).exec();
   return numeroDeDocumentos;
}

Assim, ao chamar a função assíncrona countDocuments, você receberá uma promise que contém o número de documentos.
Comment: Agradeço a resposta João, mas ainda não consegui pegar o valor da variável e passar para o array. Tentei de várias formas, segue uma delas: `  async function docs() {
    const numDocs = await Vendas.countDocuments({ dt_encerramento: { $gte: jan, $lte: abr }}).exec();
    return numDocs;
  }
  docs().then(function (err,n) {
    y.push(n);
  });
`
Comment: É preciso compreender a diferença entre trabalho assíncrono e trabalho síncrono. Nesse caso por exemplo, dentro de outra função async, você pode fazer: `y.push(await countDocuments())`


Unusual Pedal(?) Marking, Hungarian Dance No.5 Arr. Merle J Isaac

Question:
Not too sure what the markings from 77-81 and 83-87 are asking for, my instructor thought some sort of pedal marking but we weren't really sure what it was specifically asking for, and we don't have a name for the symbol.
Comment: @AndyBonner *Original* orchestral version? The original was for piano solo (although the tune itself of n. 5  wasn't by Brahms) and the chords weren't arpeggios.  In addition, Brahms didn't orchestrate n.5 himself according to [Wiki](https://en.wikipedia.org/wiki/Hungarian_Dances_(Brahms))
Comment: @Aaron Yes, the first *published* version was for piano duet, but according to Jan Swafford's biography he had been playing them for years for friends and gave Clara Schumann some manuscripts. "Finally, in hopes of good return, he did write down some dances, setting them for four hands to get the orchestral effects he wanted."
Comment: I'm waiting for someone to know for sure, but I can offer a few contextualizing observations. This passage, in the original orchestral version, is usually played with an extreme crescendo over the course of each individual chord—usually an "exponential crescendo," growing mostly in the last moments of the note. Of course, a piano has limited ability to mimic this; the way it rolls the chord will have a lot to do with it. In the orchestral version, the chords are homophonic; all voices, including the bass, play throughout the measure. Based on this, I'm guessing pedaling is intended...
Comment: ... and you'd have to pedal to keep the bass notes sustaining into the second beat. I've never seen something like the "down-turned" end of the bracket, but performatively, one would want to release the pedal quite abruptly; maybe this reflects that in some way.
Comment: @DjinTonic The originals were for piano duet. Brahms later arranged 10 of them for piano solo.
Comment: @DjinTonic Tangentially, that brings up an interesting question. Since many composers wrote at the piano first before orchestrating a piece, how many pieces could be said to have been first written for the piano?
Comment: @Aaron Richard Strauss, for example, sometimes made sketches for his operas followed by a particelle (short score) before tackling the full score. I don't know how many composers first wrote out full piano versions of pieces originally intended for orchestra.
Answer: It's a pedal marking. Pedal goes down when the line goes down toward the diagonal line; pedal goes up when the line goes down away from the diagonal line. The line being diagonal has no special meaning aside from showing the duration of the sustain.
In this specific case, the goal is to sustain the low octaves while moving the left hand up to play the arpeggiated chord, but then release the pedal to accommodate the rest at the end of each measure.
Regarding the crescendo: the crescendo can be achieved while rolling through the chord.
Comment: Another instance of this style of pedal marking may be found at https://dolmetsch.com/musicalsymbols.htm (toward the bottom of the page).  I didn't find a good online resource describing its use or history, nor the reason for using a diagonal line, but I imagine that the standard books on modern notation will at least mention it.
Answer: He's  probably thinking of the "cimbalom", basically a piano without a keyboard, Plucked like a guitar there is an AMAZING effect, where the player runs his finger to and fro along the whole range of strings, since the strings aren't "damped" they all sound at once, an AMAZING effect that makes your hair stand on end. Gypsy players would use this effect on an occasional off-beat. It is OBVIOUSLY what Brahms was thinking of in his G-minor Dance on the 2cd. quaver of the 4th. bar where he marks an accent which I've never heard anyone observe.
Comment: I've had another look: the arrangement by Brahms' friend Joachim puts  a crescendo on a minim (!) in the 3rd. bar.
Comment: One last thought: at 90 years of age I knew a Hungarian "gypsy" band personally. "Gypsy" was a euphemism for JEWISH, who were in demand for Christian weddings where Jews were forbidden. What today we would  probably call "Klezmer".; wonderful stuff!
Comment: Back again: I'm getting stupid in my old age.  Correction: the cembalom is of course played with soft-head DRUMSTICKS, not  normally plucked.


How many of the integers between $100$ and $200$ are divisible by $3$ or divisible by $2$ but not by $5$?

Question: How many of the integers between $100$ and $200$ are divisible by $3$ or divisible by $2$ but not by $5$?
is the range of integer 200-100+1=101 or 100?
$A_5$ number that is divisible by 5
\begin{align*}
 A_1 & = \left\lfloor{\frac{101}{3}} \right\rfloor = 33 && \text{(divisible by $3$)}\\
 A_2 & = \left\lfloor{\frac{101}{2}} \right\rfloor = 50 && \text{(divisible by $2$)}\\
 \\
| A_1 \cap A_5 | & = \left\lfloor{\frac{101}{3 \cdot 5}}\right\rfloor = 6\\
| A_2 \cap A_5 | & = \left\lfloor{\frac{101}{2 \cdot 5}}\right\rfloor = 10\\
\\
| A_1 \cap A_2 \cap A_3 | & = \left\lfloor{\frac{101}{2 \cdot 3 \cdot 5}}\right\rfloor = 3
\end{align*}
Therefore, by the principle exclusion inclusion theorem
 $= 50 + 33 - (6 + 10) + 3 =70 $
Is this right?
Im trying to count one by one such as, and enumerate
for $100-130$ , number that divisible by 2,3 but not 5
$\{102,104,106,111,108,112,114,116,118,122,123,124,126,128\}=14$ number
$14*3=42 $ number $ (100-190)$
for
$191-200= ${ $192,194,196,198\}=4$ number
$42+4=46 $
i used program to check:
102 104 106 108 111 112 114 116 117 118 122 123 124 126 128 129 132 134 136 138 141 142 144 146 147 148 152 153 154 156 158 159 162 164 166 168 171 172 174 176 177 178 182 183 184 186 188 189 192 194 196 198
total=52
which one is right?
Comment: Counting problems should be tagged combinatorics.
Answer: Your notation is not consistent.  It looks like you are using both $A_3$ and $A_5$ to denote numbers divisible by $5$.
Let $A$ denote the set of positive integers satisfying $100 \leq n \leq 200$ which are divisible by $2$; let $B$ denote the set of positive integers satisfying $100 \leq n \leq 200$ which are divisible by $3$; let $C$ denote the set of positive integers satisfying $100 \leq n \leq 200$ which are divisible by $5$.  We wish to find
$$|(A \cup B) - C| = |A| + |B| - |A \cap B| - |A \cap C| - |B \cap C| + |A \cap B \cap C|$$
You took a shortcut that does not always work.  The number of multiples of an integer within $101$ consecutive integers is not always the same as it is for the first $101$ positive integers.  In particular, there are $50$ positive even integers between $1$ and $101$ inclusive but $51$ positive even integers between $100$ and $200$ inclusive since both $100$ and $200$ are even.  To address this issue, we subtract the number of multiples that are at most $99$ from the number of multiples that are at most $200$.
\begin{align*}
|A| & = \left\lfloor \frac{200}{2} \right\rfloor - \left\lfloor \frac{99}{2} \right\rfloor = 100 - 49 = 51\\
|B| & = \left\lfloor \frac{200}{3} \right\rfloor - \left\lfloor \frac{99}{3} \right\rfloor = 66 - 33 = 33\\
|A \cap B| & = \left\lfloor \frac{200}{2 \cdot 3} \right\rfloor - \left\lfloor \frac{99}{2 \cdot 3} \right\rfloor = 33 - 16 = 17\\
|A \cap C| & = \left\lfloor \frac{200}{2 \cdot 5} \right\rfloor - \left\lfloor \frac{99}{2 \cdot 5} \right\rfloor = 20 - 9 = 11\\
|B \cap C| & = \left\lfloor \frac{200}{3 \cdot 5} \right\rfloor - \left\lfloor \frac{99}{3 \cdot 5} \right\rfloor = 13 - 6 = 7\\
|A \cap B \cap C| & = \left\lfloor \frac{200}{2 \cdot 3 \cdot 5} \right\rfloor - \left\lfloor \frac{99}{2 \cdot 3 \cdot 5} \right\rfloor = 6 - 3 = 3
\end{align*}
Hence, the number of positive integers between $100$ and $200$ which are divisible by $2$ or $3$ but not by $5$ is
$$51 + 33 - 17 - 11 - 7 + 3 = 52$$
Comment: Thankyou so much but if the problem is "How many of the integers between 100
and 200 that are divisible by 3 or divisible by 2 or not divisible  by 5 ? Is my answer right 70?
Comment: There are $80$ numbers between $100$ and $200$ inclusive which are not divisible by $5$.  You would then have to add multiples of $2$ or $3$ which are divisible by $5$ to that number, so your answer would be larger than $80$ rather than smaller than $52$.
Comment: But what is the different from "How many of the integers between 100
and 200 are divisible by 3 or divisible by 2 but not by 5"? and  "How many of the integers between 100 and 200 that are divisible by 3 or divisible by 2 or not divisible by 5 ? for the latter do i just need to exclude number that is divisible by 5 only but not by 2 or 3? I think im worng in interpreting the problem
Comment: Divisible by $2$ or $3$ but not by $5$ should be interpreted as divisible by $2$ or divisible by $3$ and not divisible by $5$, so every multiple of $2$ not divisible by $5$ is included and every multiple of $3$ not divisible by $5$ is included.  Divisible by $2$ or $3$ or not divisible by $5$ means every multiple of $2$ is included, every multiple of $3$ is included, and every number not divisible by $5$ is included.
Comment: for the latter, if the number is multiple of 2 and  multiple of 5 ,is it included? to count all number I need only to exclude multiple of 5 but not multiple of 2 or 3?
Comment: I have one more question ,for the first problem, is multiple of 2,3,5  included or not?
Comment: In the problem divisible by $2$ or $3$ but not by $5$, multiples of $2$, $3$, and $5$ are not included.  Since multiples of $2$, $3$, and $5$ are also multiples of $2$ and $5$, we subtract multiples of $2$, $3$, and $5$ once when we subtract multiples of $2$ and $5$.  Since multiples of $2$, $3$, and $5$ are also multiples of $3$ and $5$, we also subtract multiples of $2$, $3$, and $5$ once when we subtract multiples of $2$ and $5$.  Therefore, we have subtracted them twice.  Since we only want to subtract them once, we must add them back.
Comment: In the problem divisible by $2$ or $3$ or not by $5$, multiples of $2$ and $5$ are included, as are multiples of $3$ and $5$.  I would start with the $80$ non-multiples of $5$, then add to that the number of multiples of $2$ and $5$ and the number of multiples of $3$ and $5$.  Doing so counts multiples of $2$, $3$, and $5$ twice, so we have to subtract them from the total.  I get $80 + 11 + 7 - 3 = 95$.  The six numbers between $100$ and $200$ inclusive that *do not satisfy*  divisible by $2$, divisible by $3$, or not divisible by $5$ are $115$, $125$, $145$, $155$, $175$, $185$.
Comment: Thankyou so much for clear explanation,
In the problem divisible by 2 or 3 or not by 5, when you count multiple of 2 and 5 , do you count it manually? or can i  count using $ \left\lfloor \frac{101}{2*5} \right\rfloor=10 $ is this way of counting wrong?
Comment: It is wrong since the number of multiples of $2$ and $5$ that are at most $101$ is not equal to the number of multiples of $2$ and $5$ that are between $100$ and $2000$ inclusive.  There are $11$ multiples of $2$ and $5$ satisfying $100 \leq n \leq 200$.  They are $100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200$.  To get the correct total, subtract the multiples of $2$ and $5$ which are less than $100$ from the number of multiples of $2$ and $5$ that are at most $100$.  $$\left\lfloor \frac{200}{2 \cdot 5} \right\rfloor - \left\lfloor \frac{99}{2 \cdot 5} \right\rfloor = 20 - 9 = 11$$
Comment: Thankyou so much for the detail explanation. I understood the different now!I think I didnt understand the formula so that i was wrong in interpreting the problem. Thankyou!!


How to Call WSDL Webservices from iPhone Application?

Question: I am making an iPhone app using WSDL Web-Services, but I have no idea how to call it from iPhone.
Help is appreciated.
Answer: Take a look at wsdl2objc: http://code.google.com/p/wsdl2objc/
There are a couple other tools that help create a SOAP interop layer for iOS apps, but I would suggest only using them if you have to. Take a look at using JSON to communicate with your web service.
Comment: I already have webservices with  .wsdl extension , so i have to implement it. is there  any basic toutorial link with Wsdl web services.
Comment: The tool I mentioned will create service classes allowing you to interact with existing Web services. Take a look at their wiki for a tutorial on how to use the tool: http://code.google.com/p/wsdl2objc/wiki/UsageInstructions.
Answer: Although there are some tools that would generate code for you. I don't like using them as customizing,debugging it would be painful. So here is what I do:
Download SOAP UI ( google search it ) and then give it your wsdl and endpoint it will generate sample request for you. You can get response as well.
In your XCode project View controller ( usually I do this in my Model separated from View Controller) Construct your POST using NSURLConnection Asynchronous connection,then in your didFinishLoading you have gotten the data. If response is XML then parse the XML using NSXML or libxml parser.
This will get you started.


Explaining volatility with GARCH: one-step or two-step approach?

Question: I am interested in seeing what could explain the volatility of certain financial series. I know that one can get estimates of conditional variance by running a GARCH model. My question is whether the one-step estimate of conditional variance could be used in a second regression where the square root of variance would be the dependent variable which I would regress on some regressors I am interested in?
Or would it be better just to compare the result of univariate GARCH to multivariate GARCH which includes some other variables that I think can explain the variance?
Comment: The second approach you describe would not be called "multivariate GARCH" but rather "GARCH with exogenous regressors". "Multivariate GARCH" would have several dependent variables rather than additional independent variables.
Answer: Both approaches have been used before, so it is a good question which one should be preferred.
In the two-step approach, the conditional variance is first defined (and estimated) as being conditional on the information in the variable of interest itself, particularly the past shocks and the past values of conditional variance. In the second step, additional variables are brought in to explain the variation in the conditional variance.
In the one-step approach, the conditional variance is defined and estimated as depending on the exogenous regressors in addition to the past shocks and past values of the conditional variance. There, the regressors both explain and actually help define the conditional variance (affect the values of the estimated conditional variance).
These two approaches are fundamentally different in how the conditional variance is defined. It is up to you to decide whether you are interested in defining the conditional variance with conditioning only on past shocks and past own values or also on the exogenous variables. The difference between the two should be justified by subject-matter arguments rather than statistical ones.
Note that the two-step approach seems to have the following advantage over the one-step approach: you can assess the goodness of fit of the equation where the fitted conditional variance is being explained by the exogenous regressors. There, you can see how much of the variation these variables explain. But actually you can also run a similar regression in the case of the one-step approach, too. Hence, the advantage is only apparent.
Comment: @1muflon1  If I remeber correctly, something like the two step approach is done in the Spline-GARCH paper by Engle and Rangel https://academic.oup.com/rfs/article-abstract/21/3/1187/1563802?redirectedFrom=fulltext
Comment: Thanks for answer, by any chance do you happen to know a paper which employs the two step approach?
Comment: @1muflon1, I do not recall any particular paper, but I think I have seen a few. You should be able to find examples by searching for relevant academic articles. The general idea of first measuring the conditional variance and then trying to explain it is quite popular. The particular idea of using GARCH for estimating conditional variance is perhaps somewhat less popular, especially if variance estimates based on high-frequency data are available. But when high-frequency data is not available, using GARCH to obtain fitted conditional variance is natural enough.
Comment: By high frequency you mean intraday data? I have daily data for other purposes I would consider this high frequency, but I usually see people going for GARCH with daily data. Especially in my case the AR model shows heteroskedasticity in residuals and I also tested for ARCH effects with the Engles test and it was highly significant
Comment: @1muflon1, by high-frequency I mean data that are of higher frequency than the exogenous regressors used to explain the conditional variance. If your regressors are monthly, then daily data will be high frequency. If you regressors are daily, then intra-daily data will be high frequency.


Como não fazer a quebra de página no iTextSharp dividir a minha table nas duas páginas

Question: Gostaria de fazer com que meu pdf colocasse na próxima folha a table que não teve espaço suficiente na última e não dividisse essa table nas duas folhas.
<code>  if (reader.HasRows)
        {
            while (reader.Read())
            {
                servico.idVenda = reader.GetInt32(0);

                if (servico.idVenda != idVendaOld)
                {
                    PdfPTable tableTotal = new PdfPTable(3);
                    float[] colsTableTotal = { 14, 3, 20 };
                    tableTotal.SetWidths(colsTableTotal);
                    tableTotal.WidthPercentage = 100f;
                    tableTotal.PaddingTop = 5;

                    tableTotal.DefaultCell.Border = PdfPCell.BOTTOM_BORDER;

                    tableTotal.AddCell(getNewCell("Total:", titulo, Element.ALIGN_LEFT, 2, PdfPCell.BOTTOM_BORDER, preto, branco));
                    tableTotal.AddCell(getNewCell(somaSubTotal.ToString("c"), font, Element.ALIGN_LEFT, 2, PdfPCell.BOTTOM_BORDER, preto, branco));
                    tableTotal.AddCell(getNewCell(somaTotal.ToString("C"), font, Element.ALIGN_LEFT, 2, PdfPCell.BOTTOM_BORDER, preto, branco));

                    somaTotal = 0;
                    somaSubTotal = 0;

                    if (contador != 0)
                    {
                        doc.Add(tableTotal);
                    }

                    PdfPTable tableTitulos = new PdfPTable(5);
                    BaseColor fundo = new BaseColor(200, 200, 200);

                    float[] colsW = { 5, 15, 10, 10, 10 };
                    tableTitulos.SetWidths(colsW);
                    tableTitulos.WidthPercentage = 100f;

                    tableTitulos.DefaultCell.Border = PdfPCell.BOTTOM_BORDER;
                    tableTitulos.DefaultCell.BorderColor = preto;
                    tableTitulos.DefaultCell.BorderColorBottom = new BaseColor(255, 255, 255);

                    servico.cliente = reader.GetString(1);
                    servico.carro = reader.GetString(2);
                    servico.placa = reader.GetString(3);
                    servico.data = reader.GetDateTime(7);

                    tableTitulos.AddCell(getNewCell("OS:", fontPeriodo, Element.ALIGN_LEFT, 2, PdfPCell.NO_BORDER, preto, fundo));
                    tableTitulos.AddCell(getNewCell("Cliente:", fontPeriodo, Element.ALIGN_LEFT, 2, PdfPCell.NO_BORDER, preto, fundo));
                    tableTitulos.AddCell(getNewCell("Carro:", fontPeriodo, Element.ALIGN_LEFT, 2, PdfPCell.NO_BORDER, preto, fundo));
                    tableTitulos.AddCell(getNewCell("Placa:", fontPeriodo, Element.ALIGN_LEFT, 2, PdfPCell.NO_BORDER, preto, fundo));
                    tableTitulos.AddCell(getNewCell("Data:", fontPeriodo, Element.ALIGN_LEFT, 2, PdfPCell.NO_BORDER, preto, fundo));

                    tableTitulos.AddCell(getNewCell(servico.idVenda.ToString(), font, Element.ALIGN_LEFT, 2, PdfPCell.BOTTOM_BORDER, preto, fundo));
                    tableTitulos.AddCell(getNewCell(servico.cliente, font, Element.ALIGN_LEFT, 2, PdfPCell.BOTTOM_BORDER, preto, fundo));
                    tableTitulos.AddCell(getNewCell(servico.carro, font, Element.ALIGN_LEFT, 2, PdfPCell.BOTTOM_BORDER, preto, fundo));
                    tableTitulos.AddCell(getNewCell(servico.placa, font, Element.ALIGN_LEFT, 2, PdfPCell.BOTTOM_BORDER, preto, fundo));
                    tableTitulos.AddCell(getNewCell(servico.data.ToShortDateString(), font, Element.ALIGN_LEFT, 2, PdfPCell.BOTTOM_BORDER, preto, fundo));

                    PdfPTable tableTitulosDados = new PdfPTable(5);
                    float[] colstableTitulosDados = { 25, 5, 10, 10, 15 };
                    tableTitulosDados.SetWidths(colstableTitulosDados);
                    tableTitulosDados.WidthPercentage = 100f;

                    tableTitulosDados.DefaultCell.Border = PdfPCell.NO_BORDER;

                    Paragraph espaco = new Paragraph((new Phrase("\n")));
                    doc.Add(espaco);

                    tableTitulosDados.AddCell(getNewCell("Serviços:", titulo, Element.ALIGN_LEFT, 2, PdfPCell.NO_BORDER, preto, branco));
                    tableTitulosDados.AddCell(getNewCell("Preço:", titulo, Element.ALIGN_LEFT, 2, PdfPCell.NO_BORDER, preto, branco));
                    tableTitulosDados.AddCell(getNewCell("Valor Cobrado:", titulo, Element.ALIGN_LEFT, 2, PdfPCell.NO_BORDER, preto, branco));
                    tableTitulosDados.AddCell(getNewCell("Situação:", titulo, Element.ALIGN_LEFT, 2, PdfPCell.NO_BORDER, preto, branco));
                    tableTitulosDados.AddCell(getNewCell("Forma de Pagamento:", titulo, Element.ALIGN_LEFT, 2, PdfPCell.NO_BORDER, preto, branco));

                    doc.Add(tableTitulos);
                    doc.Add(tableTitulosDados);

                    idVendaOld = servico.idVenda;
                    contador += 1;
                }

                servico.servico = reader.GetString(4);
                servico.preco = reader.GetDouble(5);
                servico.valorCobrado = reader.GetDouble(6);
                servico.formaPagamento = reader.GetString(9);

                PdfPTable tableDados = new PdfPTable(5);
                float[] colsTableDados = { 25, 5, 10, 10, 15 };
                tableDados.SetWidths(colsTableDados);
                tableDados.WidthPercentage = 100f;

                tableDados.DefaultCell.Border = PdfPCell.TOP_BORDER;
                tableDados.DefaultCell.Border = PdfPCell.BOTTOM_BORDER;

                tableDados.AddCell(getNewCell(servico.servico, font, Element.ALIGN_LEFT, 2, PdfPCell.BOTTOM_BORDER, preto, branco));
                tableDados.AddCell(getNewCell(servico.preco.ToString("C"), font, Element.ALIGN_LEFT, 2, PdfPCell.BOTTOM_BORDER, preto, branco));
                tableDados.AddCell(getNewCell(servico.valorCobrado.ToString("C"), font, Element.ALIGN_LEFT, 2, PdfPCell.BOTTOM_BORDER, preto, branco));

                if (servico.pago == true)
                {
                    tableDados.AddCell(getNewCell("PAGO", font, Element.ALIGN_LEFT, 2, PdfPCell.BOTTOM_BORDER, preto, branco));
                }
                else
                {
                    tableDados.AddCell(getNewCell("EM ABERTO", font, Element.ALIGN_LEFT, 2, PdfPCell.BOTTOM_BORDER, preto, branco));
                }

                tableDados.AddCell(getNewCell(servico.formaPagamento.ToString(), font, Element.ALIGN_LEFT, 2, PdfPCell.BOTTOM_BORDER, preto, branco));

                somaSubTotal += servico.preco;
                somaTotal += servico.valorCobrado;

                totalSomaTotal += servico.valorCobrado;
                totalSomaSubTotal += servico.preco;

                doc.Add(tableDados);

            }

            PdfPTable tableUltimoTotal = new PdfPTable(3);
            float[] colstableUltimoTotal = { 14, 3, 20 };
            tableUltimoTotal.SetWidths(colstableUltimoTotal);
            tableUltimoTotal.WidthPercentage = 100f;
            tableUltimoTotal.PaddingTop = 5;

            tableUltimoTotal.DefaultCell.Border = PdfPCell.BOTTOM_BORDER;

            tableUltimoTotal.AddCell(getNewCell("Total:", titulo, Element.ALIGN_LEFT, 2, PdfPCell.BOTTOM_BORDER, preto, branco));
            tableUltimoTotal.AddCell(getNewCell(somaSubTotal.ToString("c"), font, Element.ALIGN_LEFT, 2, PdfPCell.BOTTOM_BORDER, preto, branco));
            tableUltimoTotal.AddCell(getNewCell(somaTotal.ToString("C"), font, Element.ALIGN_LEFT, 2, PdfPCell.BOTTOM_BORDER, preto, branco));

            doc.Add(tableUltimoTotal);
</code>
Answer: Você pode indicar que o objeto ou determinadas linhas devem permanecer juntas
<code>PdfPTable tableUltimoTotal = new PdfPTable(3);
tableUltimoTotal.KeepTogether = true;
//E ou...
tableUltimoTotal.KeepRowsTogether(0);
</code>
Comment: Deu certo cara, muito obrigado!


Linux IPv6 loopback routes getting automatically added

Question: We have a router running Debian Lenny that has been happily routing IPv6 for several months. Our upstream has advised that our address range is changing, and both are currently operational, so I thought I'd add the second address for testing.
ip -6 addr add 2405:3c00:1:13::2/64 dev eth1
# ping6 2405:3c00:1:13:: (our upstream router)
64 bytes from 2405:3c00:1:13::2: icmp_seq=1 ttl=64 time=0.089 ms

What?
# ip -6 route get 2405:3c00:1:13::
local 2405:3c00:1:13:: from :: via :: dev lo  table local  proto none  src 2405:3c00:1:13::2  metric 0  mtu 16436 advmss 16376 hoplimit 4294967295
# route -6 | grep 2405
2405:3c00:1:13::/64        ::                    U    256 0     1 eth1
2405:3c00:1:13::/128       ::                    Un   0   1     0 lo
2405:3c00:1:13::2/128      ::                    Un   0   1     0 lo

I am curious how the ...13::/128 route arrived. It appears about two seconds after I add the address to the interface. radvd(8) is not enabled on the interface, unsetting accept_ra and autoconf makes no difference.
Is there any easy way to keep an eye on which process is modifying the routing table? Does anyone have any brilliant ideas about what the culprit might be?
Answer: In any /64 subnet, the ::0 address is the subnet-router anycast address; it identifies all routers on the link. Since you have net.ipv6.conf.all.forwarding turned on, the system identifies itself as a router and joins that anycast group. Unfortunately, this behavior isn't really documented or configurable, so you probably have about the right solution.
More ideal would be not using that address, since it's technically reserved, but that may not be an option with your ISP.
You may have noticed that the route only shows up with route -6 and not ip -6 route. That's because the route is in the local table, rather than main. You can see it with ip -6 route list table local. Just removing that /128 route might do the trick.
Comment: That's great, thanks. I managed to convince upstream to move away from the ::0 address.
Answer: (In the short term we have solved this with
# ip -6 addr add 2405:3c00:1:13::/128 dev  eth1
# ip -6 addr delete 2405:3c00:1:13::/128 dev  eth1
# route -6 | grep 3c00
2405:3c00:1:13::/64            ::                         U    256 0     0 eth1
2405:3c00:1:13::2/128          ::                         Un   0   1     0 lo

but that is a bodgy hack.)


ios:set tabbar top border only

Question:
i have apply this bellow code for tabbar border

self.tabBarController?.tabBar.layer.borderWidth = 0.8 self.tabBarController?.tabBar.layer.borderColor =  self.tabBarController?.tabBar.tintColor.cgColor

but using this code border apply at all side and i want border only top side of tabbarmy tabbar that show tabbar border all side (top,left,right,bottom)
i want tabbar like this sample image that show border only at top side
  now what should i have to do ?
  Thanks
Comment: it is not relevant to my question @Lalitkumar i cant found answer of my question
Answer: <code>//First, remove the default top line and background
UITabBar.appearance().shadowImage = UIImage()
UITabBar.appearance().backgroundImage = UIImage()

//Then, add the custom top line view with custom color. And set the default background color of tabbar
let lineView = UIView(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: 1))
lineView.backgroundColor = UIColor.red
self.tabBarController?.tabBar.addSubview(lineView)
self.tabBarController?.tabBar.backgroundColor = UIColor.init(colorLiteralRed: 248.0/255.0, green: 248.0/255.0, blue: 248.0/255.0, alpha: 1.0)
</code>
It looks like this:

ios:set tabbar top border only


Why is the average noise generated by the two-sided geometric distribution not null?

Question: I am implementing the distributed differential privacy scheme proposed in this paper http://www.elaineshi.com/docs/ndss2011.pdf. Page 13 they represent a graph with the error added by a naive scheme and they say that "the naive scheme is where each participant adds independent geometric noise to her input and uploads the perturbed data to the aggregator". The geometric distribution proposed in this paper to generate noise is the two-sided geometric distribution whose probability mass function at k is (α−1/α+1)·α^(−|k|) where α > 1. It looks like this, with α=1.1
I don't understand why the error increases (for the naive scheme) with the number of users, since the mean of the probability distribution is 0. It seems to me that if we have N users adding independent noise to their data with this probability distribution, the ones adding negative noise and the ones adding positive noise should compensate, and when the aggregator does the sum of their data we should get an error close to 0. I am probably missing something...
Thank you all :)
Answer: The plot on page 13 shows the mean and standard deviation of error in absolute terms. Since they're using the absolute value of errors, positive and negative errors do not cancel out. Since they're looking at error over a summation problem, the more items they sum, the bigger the error gets.
Comment: I thought the error in absolute value meant | ∑ Ri | (where Ri is the noise added to the value Xi) and not ∑ | Ri | since the error of the scheme is defined as ∑ Ẍi - ∑ Xi (where Ẍi = Xi + Ri). Indeed in this case your answer would make sense but I am not sure which one of the two terms they are plotting. Thanks for the answer.


Find if a date is in date range using MySQL

Question: Hi I have following values stored in MySQL table:
--- ------------------------     -------------------
Id | StartDate (VARCHAR (20))  | EndDate(VARCHAR(20))
--- ------------------------     -------------------
1  | 03-04-2017                | 18-04-2017

I am using the following SQL to find if the date is within the StartDate and EndDate:
SELECT
(date_format(str_to_date('03-04-2017','%d-%m-%Y'),'%d-%m-%Y') >= StartDate
AND
date_format(str_to_date('03-04-2017','%d-%m-%Y'),'%d-%m-%Y') <= EndDate) AS
valid
FROM holiday

My issue is it that when I execute the query and provide 03-04-2017 it returns 1 but also returns 1 when I provide 03-05-2017.
Could someone please highlight what is wrong in this query?
Comment: what datatype have the field ? VARCHAR or DATE ?
Comment: @BerndBuffen Thanks they both are varchar and unfortunately I cannot change schema.
Comment: You need to convert the string to a date
Comment: @juergend Thanks but doesn't this convert string to date .. date_format(str_to_date('03-04-2017','%d-%m-%Y'),'%d-%m-%Y')
Comment: first of all you should really consider converting your table from `varchar` to `date`. it's ridiculous you store date in varchar non iso format
Answer: Use a query like this:
SELECT *
FROM holiday
WHERE
    STR_TO_DATE(StartDate,'%d-%m-%Y')
BETWEEN
    str_to_date('03-04-2017','%d-%m-%Y')
AND
    str_to_date('03-04-2017','%d-%m-%Y');

sample
mysql> SELECT IF(STR_TO_DATE('11-04-2017','%d-%m-%Y')
    ->             BETWEEN
    ->                 str_to_date('03-04-2017','%d-%m-%Y')
    ->             AND
    ->                 str_to_date('10-04-2017','%d-%m-%Y')
    ->
    -> ,'YES','NO') AS ANSWER;
+--------+
| ANSWER |
+--------+
| NO     |
+--------+
1 row in set (0,00 sec)

mysql> SELECT IF(STR_TO_DATE('04-04-2017','%d-%m-%Y')
    ->             BETWEEN
    ->                 str_to_date('03-04-2017','%d-%m-%Y')
    ->             AND
    ->                 str_to_date('10-04-2017','%d-%m-%Y')
    ->
    -> ,'YES','NO') AS ANSWER;
+--------+
| ANSWER |
+--------+
| YES    |
+--------+
1 row in set (0,01 sec)

mysql>

Comment: Thanks but I need to find if the "given" date is between "StartDate" and the "EndDate". Your solution  returns records between these dates. For example it should return Yes  if the date is 04-04-2017 and No if the date is 19-04-2017 as it is not between StartDate and EndDate.
Comment: i have add a sample in my answer, so you only must put it in the field section
Answer: You can use BETWEEN operator to compare the dates, e.g.:
SELECT *
FROM `table`
WHERE '2017-04-03' BETWEEN start_date AND end_date;

Update
If the dates are stored as varchar then you need to convert it to date before comparing, e.g.:
SELECT *
FROM table
WHERE '2017-04-03' BETWEEN STR_TO_DATE(start_date, '%d-%m-%Y') AND STR_TO_DATE(end_date, '%d-%m-%Y');

Here's the SQL Fiddle.
Comment: It is stored as string and not in the format you use either
Comment: @juergend noticed the update to the question after posting the answer. Chaged now.
Answer: All other answers are good for your question but in my opinion you should convert your database.
It's only sane option.
Using dates in weird VARCHAR format will have big impact in future. Not only it impacts perfomances of your tables right now but you are missing whole MySQL date API ecosystem because of it.

Add temporary columns let's say tmp_start_time DATE
Fill them with dates UPDATE holiday SET tmp_start_time = str_to_date(start_time,'%d-%m-%Y')
Drop old varchar keys in table
Add same keys but as DATE
Update them UPDATE holiday SET start_time = tmp_start_time

From now on you would be able to use BETWEEN as everyone else without str_to_date

I just found your comment

unfortunately I cannot change schema

ask yourself twice: are you sure?
Comment: Thank you for your suggestion and I agree 100%, but in my situation I have inherited this application and I am under instructions to not change the schema as it might break some reports.


Stopping/Starting Windows services

Question: I have four Windows services which start up automatically when the machine starts. Thereafter, I want to restart those services every 8 hours in a particular order.
e.g. Stop s1,s2,s3,s4 and than restart them in some other order like s4,s3,s2,s1. The condition is that I should wait for each service to stop completely before I stop another one.
I would want to write a .BAT or some script. Is it possible to define a scheduled task for 8 hours? This is not there in Advanced tasks. Can I do it using Windows Task Scheduler?
Comment: Out of curiosity, why do you want to restart the services?
Comment: They all get hung after running for almost 12-14 hours. 8 hours is a logical point of start for the new shift to work. We are working on getting this fixed.
Answer: In a batch file:
<code>net stop service4
net stop service3
net stop service2

net start service2
net start service3
net start service4
</code>
Assuming you are using xp/2003 or above you could create a scheduled task to run the batch file. Assuming you want to repeat the task every 8 hours, pick a time for it to run, then on the properties of the scheduled task, schedule tab > advanced... > repeat task.
Change it to repeat every 8 hours.
Comment: +1. It doesn't get any easier than this.

Stopping/Starting Windows services


Validate 2 Json Fields for Not Null at the same time

Question: I have below JSON . At any point of time only one of the field "car" or "bike" can be null .Not both at the same time.How can I validate json using Jackson annotations.
All the fields in JSON are mandatory
<code>{
    "name": "John",
    "age": 30,
    "car": "Toyota",
    "bike": "Honda"
}
</code>
My Java Pojo Objects
<code>  public class Example
 {
    @JsonProperty("name")
    public String name;

    @JsonProperty("age")
    public Integer age;

    @JsonProperty("car")
    public String car;

    @JsonProperty("bike")
    public String bike;
</code>
Comment: Take a look at [@Valid when creating objects with jackson without controller](https://stackoverflow.com/q/55457754/51591). You can implement a new validator which would check these two fields: [How can I validate two or more fields in combination?](https://stackoverflow.com/questions/2781771/how-can-i-validate-two-or-more-fields-in-combination)
Answer: Depending what you want, you can use @NotBlank from javax.validation.constraints.NotBlank;
<code> public class Example
 {
    @NotBlank(message = "This field cannot be blank")
    @JsonProperty("name")
    public String name;

    @JsonProperty("age")
    public Integer age;

    @JsonProperty("car")
    public String car;

    @JsonProperty("bike")
    public String bike;
}
</code>
You can also try @NotNull or @NotEmpty from same package. They have some differences, see what best fit on your case.


form validation in cakephp

Question: I have one model login - it has 5 fields. At time of registration I am validating all the fields, but when I edit the record I want to validate only some fields before saving the data.
I am using this code:
if ($this->Login->validates(array('fieldList' => array('password','name')))) {
    if ($this->Login->save($this->data)) {
        echo 'helllo';exit;
        //$this->Session->setFlash('Your post has been updated.');
        //$this->redirect(array('action' => 'profile'));
    }else {

    }
} else {

}

But it's not working.
Answer: You should properly do this by setting on to create in the validation rule. Repeating this logic in the controller every time is bad.
The specific problem in your case is that save is validating again, and validating all fields. In fact, the first call the validates is entirely superfluous. You will have to use the third $fieldlist parameter of the save function if you only want to save/validate certain fields:
$this->Login->save($this->data, true, array('password','name'))

Comment: its because i am using primary key someid in place  of id .
Answer: You better seperate everything, at first you validate, if everything goes ok, only then, save any data.
Validation should return some data, where it has failed, additionally, there are different data types, different things to check, for each field - there should be some classification for your site, what are limits, for specific field.
Answer: If I understand you correctly, you only want the validation to apply on create, and not update. Cake has this functionality built in.
In your model, where each fields validation rules are, you will have something similar to:
var $validate = array(
    'fieldName1' => array(
        'rule' => 'ruleName', // or: array('ruleName', 'param1', 'param2' ...)
        'required' => true,
        'allowEmpty' => false,
        'on' => 'create', // or: 'update'       ** here **
        'last' => false,
        'message' => 'Your Error Message'
    )
);

Might resolve your issue.

form validation in cakephp


Bivariate normality and statistical work when the joint density is not defined

Question: Let $X$ follow a Normal distribution, and let $Y = a+bX$ (not both constants zero). The normal distribution is closed under shifting and scaling, so $Y$ also follows a normal distribution.
If I recall correclty, there exists "Cramer's condition" for bivariate normality, where we get it if all linear combinations of two random variables have a univariate normal distribution. In our case it is easy to see that any $Z = \delta_1X + \delta_2 Y$ will follow a Normal distribution too (not both constants zero). So it appears that $(X,Y)$ are jointly normal, with correlation coefficient equal to unity, in absolute value.
The question is the following: the joint support of $(X,Y)$ is a line in $\mathbb R^2$, and as a $(n-1)-$dimensional object in a $n-$dimensional space, it has Lebesgue measure zero. This I think, implies that the joint probability density function does not exist.
Q1: Is the above correct?
Q2: What are the main practical consequences of not being allowed to define the joint density (like, indicatively, what kind of statistical work we cannot do, and what kind we still can do, what statistical methods are no longer applicable, and which are still applicable)?
I guess the situation generalizes to any distribution that is closed under affine transformations, and when we want to assume in addition that the bivariate vector follows the 2-D analogue of the marginal distributions.
Comment: In Cramer's condition, you don't need to state that $X$ and $Y$ are normal random variables: if _all_ linear combinations $\delta_1X+\delta_2Y$ are normal **(where the coefficients are allowed to be $0$)** then $X$ and $Y$ are jointly normal.  Many people take this as the _definition_ of bivariate (or more generally, multivariate) normality even though it allows for $0$ (more generally, a constant) to be thought of as a (degenerate) normal random variable. See the extensive discussion in the comments following [this answer](https://stats.stackexchange.com/a/30160/6633)
Comment: Since the *only* potential problem in working with the random variable $(X,Y)$ with a singular distribution concerns how it is represented mathematically, any failure to perform "statistical work" would merely represent a failure on the analyst's part to describe the situation in an effective way. It could not possibly preclude the use of any statistical procedures. What would an "effective way" mean?  It can be as simple as just ignoring $Y$, because its values are determined by $X$. Thus there seem to be no conceptual, theoretical, or practical difficulties engendered by this situation.
Comment: Also, if $Y=a+bX$ then the correlation coefficient _could_ be $-1$ , not just $+1$ as implied by "correlation coefficient equal to unity".
Comment: You still need to delete the requirement that the coefficients must be nonzero; otherwise, there is no way to show that $X$ and $Y$ are marginally normal. Unless, of course, you mean that $\delta_1,\delta_2)\neq (0,0)$ in which case you should say so explicitly.
Comment: @Xi'an As a stand-alone mere statement this is hardly useful. Could you perhaps elaborate by posting a related answer? Thank you.
Answer: Let $P_{XY}(A) := P\left((X , Y) \in A\right)$. There exists a set $A \in \mathfrak B^2$ (the Borel $\sigma$-algebra over $\mathbb R^2$) such that $\lambda^2(A) = 0$ yet $P_{XY}(A) > 0$, so $P_{XY}$ is not dominated by $\lambda^2$ and therefore it has no Lebesgue pdf (with respect to $\lambda^2$, the Lebesgue measure on $\mathbb R^2$), as you said. That's not up for debate. But, as @Dilip Sarwate says in the comments, we can consider $(X , Y)$ to have a degenerate bivariate Gaussian distribution. I think the way to reconcile this is that having a pdf proportional to $\exp\left(-\frac 12 (z - \mu)^T \Sigma^{-1} (z - \mu)\right)$ with $z \in \mathbb R^n$ is sufficient, but not necessary, for being a Gaussian over $\mathbb R^n$. That's one key advantage to the definition of a multivariate Gaussian being $Z \sim \mathcal N_n(\mu, \Sigma)$ iff $a^T Z \sim \mathcal N_1(a^T \mu, a^T \Sigma a)$ for all $a \in \mathbb R^n$ rather than specifying a pdf for $Z$.
Now let $h(x) = a + bx$ so $h$ is measurable. We have
$$
P(X \in A_1, Y \in A_2) = P(X \in A_1, X \in h^{-1}(A_2)) = P(X \in A_1 \cap h^{-1}(A_2)) = P_X(A_1 \cap h^{-1}(A_2)).
$$
We do have $P_X \ll \lambda$ (assuming $X$ is not also degenerate) so the 1-dimensional Lebesgue pdf $\frac{\text dP_X}{\text d\lambda}$ is defined. Thus we have
$$
P_{XY}\left(A_1 \times A_2\right) = \int_{A_1 \cap h^{-1}(A_2)} \frac{\text dP_X}{\text d\lambda} \,\text d\lambda
$$
so even though the 1-dimensional Gaussian pdf $\frac{\text dP_X}{\text d\lambda}$ isn't the pdf of $P_{XY}$, it is still all we need to perfectly describe $P_{XY}$.
To conclude, if $(X, Y)$ is degenerate it won't have a pdf with respect to $\lambda^2$ but it is still considered a bivariate Gaussian, and we can compute $P((X, Y) \in A_1 \times A_2)$ by integrating the pdf of $X$ with respect to to Lebesgue measure on $\mathbb R$. This agrees with @whuber's comment because there's no mystery about the behavior of $(X, Y)$, it just doesn't have a 2-D pdf.


return other indexed fields using SearchApiQuery($index)

Question: I created an index that indexes taxonomy terms.
I indexed the term name + field_skill type text.
The current result shows only the term id + score.
I want to show also the field_skill.
<code> $term = 'drupal';

 // Select an index.
 $index = search_api_index_load("terms");
 $query = new SearchApiQuery($index);

 // Conditions.
 $query->condition('name', $term, '=');
 // $query->condition('language', $language->language, '=');

 // Fetch results.
 $results = $query->execute()['results'];
 dpm($results); // returns only ids and score I want to return other indexed fields
</code>
Comment: Which backend are you using? Solr? Db? Other?
Comment: Apache Solr Server
Answer: If you are using Solr, on server configuration (admin/config/search/search_api/server/YOUR_SERVER_NAME/edit), under "Advanced" fieldset, you should enable the "Retrieve result data from Solr" option:


Erro com "cordova run android"

Question: Estou recebendo um erro ao entrar o comando: "cordova run android"
OBS: Lembrando que já setei o caminho do sdk:
export PATH=$PATH:/home/giovanni/android/sdk/tools:/home/giovanni/android/sdk/platform-tools:/home/giovanni/android/sdk/build-tools:/home/giovanni/android/sdk/build-tools

ERRO:
giovanni@deathstar:~/Documentos/garconapp$ cordova run android

Error: Failed to find 'ANDROID_HOME' environment variable. Try setting setting it manually.
Failed to find 'android' command in your 'PATH'. Try update your 'PATH' to include path to valid SDK directory.
Answer: Para corrigir este erro, basta instalar o android studio. E o mesmo sem encarrega de configurar essas variáveis de sistema.
Answer: O Android Home deve ser a pasta raíz (root folder) do SDK.
Caso esteja usando o Windows, tente:
set ANDROID_HOME=C:\\android-sdk-windows
set PATH=%PATH%;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools

Leia mais clicando aqui
Se o erro persistir, dê uma olhada aqui.
EDIÇÃO:
Para Linux, no seu caso, então:
export ANDROID_HOME="$HOME/android-sdk-linux"

Comment: também é bom fazer download disto: https://dl.google.com/android/repository/tools_r25.2.3-windows.zip e extrair para C:\Users\CURRENT_USER\AppData\Local\Android\sdk só assim é que eu consegui resolver o meu problema
Answer: Tenta editar o arquivo bashrc como sudo:
sudo vim ~/.bashrc
No fim do arquivo, coloca:
export ANDROID_HOME=$HOME/Android/Sdk
export PATH=$PATH:$ANDROID_HOME/tools:/platform-tools/:/build-tools/
No meu caso, o arquivo com bin e bibliotecas do Android está na pasta do usuário, por isso eu uso $HOME como inicio do caminho até o arquivo, o seu pode ser diferente, só mudar o primeiro export pro seu ai.
Depois de salvar (:wq no vim), para aplicas as mudanças, executa:
source ~/.bashrc
Answer: Para fazer BUILD ANDROID
No cmd ->        endereço do seu projeto (D:\xampp\htdocs\TESTE5) >  cordova build android
Segue abaixo os passos que deve aparecer para dar build corretamente
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=C:\Users\Marcos\AppData\Local\Android\Sdk (DEPRECATED)
Welcome to Gradle 4.10.1!
Here are the highlights of this release:

Incremental Java compilation by default
Periodic Gradle caches cleanup
Gradle Kotlin DSL 1.0-RC6
Nested included builds
SNAPSHOT plugin versions in the plugins {} block
For more details see https://docs.gradle.org/4.10.1/release-notes.html
Starting a Gradle Daemon (subsequent builds will be faster)
BUILD SUCCESSFUL in 18s
1 actionable task: 1 executed
Subproject Path: CordovaLib
Subproject Path: app

•   E no meu computador:
•   Android Studio instalado e o JAVA instalado (C:\Program Files\Java\jdk1.8.0_131)
•   Nas variáveis de ambiente:
•   ANDROID_HOME    ->     C:\Users\Android\Sdk  (endereço do seu sdk)
•   JAVA_HOME  ->  C:\Program Files\Java\jdk1.8.0_131
•   No path:      %ANDROID_HOME%\tools,   %ANDROID_HOME%\platform-tools,  %JAVA_HOME%\bin

Erro com "cordova run android"


Events A & B - Probability

Question: The probability of A occurring is $A={5\over9}$, the probability of B occurring is $B=0.65$ and the probability of B occurring but not A is 1/6

Find the probability when both events A and B occur
Find the probability when event A occurs when it is known that event B does not occur
Comment: What you tried?
Answer: Use this:
$$P(B) = P(B - A) + P(B\cap A).$$
Comment: For which one a. or b. ?
Comment: The probability of $B$ occurring butnot $A$ is $P(B - A)$.
Comment: And is P(B∩A) the probability of both of them happening ?
Comment: That is correct.
Comment: But i already know that the probability of B occurring butnot A is 1/6

Events A & B - Probability


Drupal Commerce Rules & Custom Actions

Question: When the checkout process is complete I'd like to record the SKU and the user ID in a separate table in my database.
Is the best approach to use the Rules module, using the 'Completing the checkout process' event and writing a custom action?
If so, how would I be best going about this?
Advice on how best to achieve the above would be appreciated.
Answer: I don't know of any modules that enable you to write db records in rules actions.
I guess you could write a custom rules action to write to your custom table and grab all the data in rules but it's just as easy to do something like below using  hook_commerce_checkout_complete:
The trickiest part is obtaining the SKU
<code><?php
  function hook_commerce_checkout_complete($order) {
    $ow = entity_metadata_wrapper('commerce_order', $order);

    foreach ($ow->commerce_line_items as $line_item) {
     $sku = $line_item->commerce_product->sku->value();

     $record = array(
      'uid' => $uid,
      'order_id' => $order->order_id,
      'order_numer' => $order->order_number,
      'sku' => $sku,
     );
     drupal_write_record('my_custom_table', $record);
    }
  }
?>
</code>
Hope this helps.
Comment: Thanks for the answer. I'll give this a go and get back to you. Looks like the sort of things I'm searching for.

Drupal Commerce Rules & Custom Actions


Geopandas warning on read_file()

Question: I'm getting the following warning reading a geojson with geopanda's read_file():
...geodataframe.py:422: RuntimeWarning: Sequential read of iterator was interrupted. Resetting iterator. This can negatively impact the performance.
  for feature in features_lst:

Here's the code sample I used:
crime_gdf = gpd.read_file('datasets/crimes.geojson', bbox=bbox)

crimes.geojson is a file containing a large number of points, each with a 'Crime type'
bbox defines the boundaries
The code runs as expected, but I don't understand that warning.
EDIT
I converted the geojson to feather, and I get the same warning.
Comment: Are you sure nothing else is writing to or otherwise using that file?
Comment: Yes, the file is being used just by this script
Comment: It's in a Google Drive folder. Can that be the reason?
Comment: I have no idea, you could just move it out of Google Drive and see if that helps
Comment: It runs with the same warning outside the Google Drive folder
Comment: Here is a hint to the provenience of the `RuntimeWarning`: I get it when using `list(src)` on a GPKG opened by Fiona 1.8.18. Looks like a regression. I don't get the warning in 1.8.13.
Comment: What's your fiona version?
Comment: Also no problem in 1.8.17.
Comment: My fiona version is 1.8.18
Answer: See my comment in Fiona's issue tracker: https://github.com/Toblerity/Fiona/issues/986
GDAL (the library Fiona uses to access the geodata) maintains an iterator over the features that are currently read. There a some operations that, for some drivers, can influence this iterator. Thus, after such operations we have to ensure that the iterator is set to the correct position that a continuous read of the data is ensured. Such operations include counting all features in a dataset, respectively calculating its extent.
There are different types of drivers in GDAL. Some drivers support random access, while some do not. For the drivers that do not support random access, the resetting of the iterator involves reading all features again up to the iterator position. As this is a possible costly operation, this RuntimeWarning is emitted, so that users are aware of this behavior.
Comment: @leosole It depends on the file you are reading. There is one driver for GeoJSON, one for GPKG, etc. So you cannot use another driver for GeoJSON.
Comment: Sorry for my ignorance in this issue, but is it possible for me to select a driver that support random access?
Comment: I see. I can convert the file to something else. I tried converting to feather, but the warning persists
Comment: @leosole This is just a warning. If you do not see any performance-related issues you can safely ignore it. I suspect with geopandas it is the the same issue as with list(src). If this is the case the warning should probably not be raised anyway.  In https://github.com/Toblerity/Fiona/issues/986 you will find more information about why list() causes this behavior.
Answer: I found this fiona PR that references the warning: https://github.com/Toblerity/Fiona/pull/965
I can reproduce the issue with fiona 1.8.18 when calling list(src) on a recently opened Collection, but not with 1.8.17. So I think this is a regression that was introduced in fiona 1.8.18, released on 2020-11-17.
Answer: While it could cause problems ignoring warnings in some contexts, I am finding this one particularly annoying repeated in my code output.
I found the warning can be ignored using
import warnings
# filter out RuntimeWarnings, due to geopandas/fiona read file spam
# https://stackoverflow.com/questions/64995369/geopandas-warning-on-read-file
warnings.filterwarnings("ignore",category=RuntimeWarning)

I added in the comments referencing this post to explain why I am filtering out these warnings.  When this warning is suppressed in a future geopandas / fiona release then this code snippet should probably be removed, as it may also suppress meaningful warnings and could be problematic in some contexts.
Comment: See this answer for how to be more specific about which warnings to suppress: https://stackoverflow.com/a/9134842/4742780

Geopandas warning on read_file()


Error: Cloning a bare git repository

Question: I tried to make a new bare git repository but I get this error:
Max:Git-Projekte max$ git clone --bare . ~/Dropbox/Git-Projekte/Mainpage.git
Cloning into bare repository '/Users/max/Dropbox/Git-Projekte/Mainpage'...
fatal: failed to open '/Users/max/Dropbox/Git-Projekte/./objects': No such file or directory

Answer: I am not sure if you are using the command the right way:
Man for git-clone says:
"Clones a repository into a newly created directory"
command is:
git clone [--template=<template_directory>]
      [-l] [-s] [--no-hardlinks] [-q] [-n] [--bare] [--mirror]
      [-o <name>] [-b <name>] [-u <upload-pack>] [--reference <repository>]
      [--depth <depth>] [--recursive] [--] <repository> [<directory>]

So maybe you should:
git clone --bare ~/Dropbox/Git-Projekte/Mainpage.git .

?
Comment: hm that does not work, i think the problem is that the command should ignore the repository and just make a bare one. But this doesn't work

Error: Cloning a bare git repository


Using a Quotient map to induce a well-defined map

Question: Let $X, Y, Z$ be Banach spaces, and let $q:X\to Y$ be a quotient map.
Given a bounded linear operator $T:X\to Z$, does there exist some criteria on $T$ for determining when $q$ can be used to induce a well-defined $\hat{T}:Z\to Y$?

Definition Let $X,Y$ be Banach spaces.  A bounded linear operator $q:X\to Y$ is a quotient map if
1) $q$ is surjective and
2) For all $y\in Y$, $\|y\| = \text{inf}\{\|x\|:q(x) = y\}$

So under the hypothesis of my question, $Y$ is a quotient of $X$ in the sense that there is a quotient map from $X$ to $Y$.
Comment: Could you be more specific. Quotient of what ?
Comment: I am not sure I understand your question, but I added more information to clarify what I am asking.
Answer: $T$ has to be surjective, $z=T(x)=T(x')$ we must have $q(x)=q(x')$. Thus $T(x)=0$ implies $q(x)=0$.

$T$ surjective
$Ker T\subset Ker q$.

We set $q'(z)=q(x)$ where $T(x)=z$.
Answer: When $q: X\rightarrow Y$ is bounded linear, $T:X\rightarrow Z$ is bd linear and surjective and $\ker T \subset \ker q$ this suffices to provide a unique bounded linear operator $\hat{T}: Z\rightarrow Y$ with $q=\hat{T} \circ T$. (Sorry, I repeat here most of what Tsemo said).
To define $y=\hat{T}(z)$ you pick $x$ so that $T(x)=z$ and set $y=q(x)$. This is independent of the choice of $x$ because of the kernel condition. It is also straigtforward to see that the obtained map is linear.
To see that it is bounded you need to know the open mapping theorem: Since $T$ is a surjective Banach space mapping, it is open whence there is $r>0$ so that $TB_X(0,r)$ contains $B_Z(0,1)$. For a given $z$ you may then pick $x$ of norm not greater than $r\|z\|$ and then $\|\hat{T}z\| =\|q(x)\|\leq \|q\| r\|z\|$.
$q$ being surjective implies that also $\hat{T}$ is surjective.


How to create new type element to form API?

Question: Drupal form API provides some built in type of element to build a form. But I want to create other type such as:
$form['mail']['#type'] = 'email';

And the output I want it to be:
<input class="input-1" type="email" id="edit-mail" name="mail" maxlength="128">

So, how can i do that?
Comment: [`hook_element_info()`](https://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_element_info/7)
Answer: You need to implement hook_element_info(). See the
form_example_elements.inc file from the Example: Form API module, and the Creating Custom Elements documentation guide.
Note that the Elements module already provides a form element type for HTML5 mail inputs.


How can we determine the relationship between A and C if A is greater than B and B is not equal to C?

Question: Given $A, B , C >0$.
If $A > B \ne C$, what can we say about $A$ and $C$. Is $A$ greater than $C$ or smaller than $C$?
Comment: You can't say anything about them.
Comment: A dog heavier than a fly, a fly and an elephant have different weights, a fly and a mosquito also have different weights.
Answer: For a simple example, let $A=4,B=3$.  Then $C=1$ and $C=5$ are both possibilities.  The fact that $B \neq C$ is not very restrictive.
Comment: Indeed, and furthermore $C=4$ is *also* permissible. So $AC$ are all possible when given $A>B$ and $B\neq C$.
Answer: We can say given information is not sufficient. So relation between A and C can't be established.
Answer: Suppose $B=1$.   Then we know $A>1$ and $C\neq 1$ but we do how they may compare to each other.   There is no comparison implied by that condition.
Examples $\{A=3, C=2\}$ satisfies the condition, though so does $\{A=3, C=3\}$, and also $\{A=3,C=4\}$.
This remains so for any value of $B$. Thus $A>B$ and $B\neq C$ permits any of $A<C, A=C, A>C$.


What is the purpose of suspended chords?

Question: I've been playing for quite a while already, 8 years in total and I am wondering, what is the main purpose of suspended chords? In most cases I use sus2 and sus4 just for color but it could be that I'm missing their real purpose in music.
I know what augmented and diminished chords are for. And chords that add a sixth, seventh, ninth, eleventh, or thirteenth are simply colour giving as well mostly.
I know that augs and dims are used to flawlessly change from one chord to another and from one key signature to another.
So do the suspended chords have some special purpose in music like augmented and diminished chords do?
Comment: The ideas quoted aren't particularly accurate. Sevenths and ninths simply for colour? And what are your views on augs and dims, so we may reference sus. chords in a similar manner.
Comment: The purpose of suspended chords is to describe a set of relative pitches. Music theory is descriptive, not prescriptive.
Comment: While I do treat ninths as being for colour and/or to harmonize melody notes in more appropriate ways, the dominant seventh is pretty useful at hammering home that you're modulating to another key (often IV or iv in this case).
Answer: A suspended chord typically shows horizontal motion for voice-leading. This is different than an "add" chord that uses upper-tertian harmony for color.
There are actually three parts to a suspension: the preparation, the suspension, and the resolution. The preparation introduces a non-chord tone to create tension, the suspension then "suspends" that non-chord tone within the harmony to prolong that tension, and the resolution then moves that bon-chord tone to a chord tone by step to resolve the tension.
Suspensions typically resolve by half-step and typically do so downward, thus, 4-3 suspensions are quite common as is an 8-7 (for a cadential 6/4) or a 9-8 / 2-1 depending on your counterpoint / voice-leading. In fact, there's a whole species of counterpoint dedicated to them (4th species).
The fact that you're not currently using them in the context I described above indicates that you're actually using a different language of harmony. Quintal / quartal harmony is based off of 4ths and 5ths, and does not follow the rules of tertian harmony. Your "sus2" / "sus4" chords are actually inversions of quintal / quartal chords.
So to reiterate, in your current context they're not really suspended chords, but if you added linear motion and used suspensions as a way of creating and resolving tension, then you'd be treating them like proper suspended chords.
I'd like to stress that you should follow up on my answer by reading a theory textbook or some such as this is just a cursory explanation - don't have time to write a whole textbook chapter for each of these answers.
Comment: You might be surprised how often 'quartal' harmony turns out to be perfectly standard (with maybe a liking for the 'add6/9' shape), the only 'quartal' thing about it is the voicing.
Comment: Are you sure 8-7 is a suspension? 8 would be consonant and 7 dissonant.
Answer: A suspension occurs when one note of a chord (typically the third in triad-based harmony) is replaced by the note one step lower or higher. In a 'prepared suspension' this note would have occurred in the previous chord. It will then resolve to the 'right' note.
This is ONE of the things that can be happening when a 'sus2' or 'sus4' chord occurs.  But, as the OP suggested, they may just be colour.
And he should realise that there is no set function for ANY type of chord.   A 7th chord (by which we mean a major triad with the minor 7th, denoted by G7, F7 etc.) very often has a dominant function.   But what about the Blues sequence, C7, F7, C7, G7, F7, C7 ?   A lot of those 'dominant 7th' shape chords aren't doing what a dominant 7th is meant to do!   And all the 'functional harmony' stuff may not be terribly applicable to today's pop/rock (or 'classical') music.


Proving the first part of the diagonalization theorem - eigenvalues and eigenvectors

Question: Let $d(\lambda_i)$ represent the geometric multiplicity, and let $m(\lambda_i)$ represent the algebraic multiplicity.
Theorem: Let $T$ be a linear operator on an $n$-dimensional vectorspace. Then $T$ is diagonalizable if and only if for each eigenvalue $\lambda_i$, we have $d(\lambda_i) = m(\lambda_i)$.
I proved $\Leftarrow$ already. I'm reading a book where the converse is proven, but I'm having trouble understanding it. It goes as follows:

Suppose $T$ is diagonalizable. Then $V$ has a basis of eigenvectors of $T$. Let $\beta$ be such a basis. Write the vectors of $\beta$ in such a way that they are ordered according to the corresponding eigenvalue: the first $m_1$ vectors correspond with the first eigenvalue $\lambda_1$, the next $m_2$ vectors correspond with the second eigenvalue $\lambda_2$, etc. It suffices to construct the diagonal matrix of $T$ with respect to this basis to see that $d(\lambda_i) = m(\lambda_i)$ voor alle eigenvalues $\lambda_i$.

I'm not sure if this really is a proof, and I don't understand what he is trying to say with his last assertion, i.e. that constructing the diagonal matrix proves what we want. Can someone clarify this please, or prove this part in an alternative manner?
Answer: Suppose that $T$ is diagonalizable, then there exist a basis $B$ of $V$ such that $[T]_B$ is a diagonal matrix with its diagonal elements as eigenvalues of $T$, so that characteristic polynomial splits over $F$. Since,
$$V=E_{\lambda_1}\oplus E_{\lambda_2}\oplus...\oplus E_{\lambda_k}$$ so if $B_i$ is basis of $E_{\lambda_i}$, then $$B=\bigcup_{i=1}^k B_i $$ is a basis of $V$ and
$[T]_B$=diag($[T_1]_{B_1},...,[T_k]_{B_k})$ where, $T_i$ is a linear operator on $E_{\lambda_i}$ induced by $T$.
Let dim$(E_{\lambda_i})=n_i$, since $T_i(x)=T(x)=\lambda_i(x)$ for all $x\in E_{\lambda_i}$ so that $$[T_i]_{B_i}=\lambda_i I_{n_i}$$, Hence the characteristic polynomial is,
$$(x-\lambda_1)^{n_1}(x-\lambda_2)^{n_2},...,(x-\lambda_k)^{n_k}$$
Which shows that $AM=GM$ for each $\lambda_i$.
Answer: It is a proof. When you compute the characteristic polynomial of the matrix described, you get a polynomial for which $d(\lambda_i)= m(\lambda_i)$ for all eigenvalues.
Answer: Hint:
The key fact is that a matrix $A$ is diagonalizable if there is a basis $\vec u_i$ such that $A\vec u_i=\lambda_i \vec u_i$, and this means that also if an eigenvalue has algebraic multiplicity $n$ it must have $n$ linearly independent correspondent eigenvectors. And your proof say this.


Opening Xcode help file and application at the same time

Question: I am noobs at Xcode. I am on my second day of learning.
When I start Xcode, the main window has a button for "Getting Started with Xcode" and a subsequent link for "Xcode workflow tutorial"
Now I would simply like the help to be open at the same time as the IDE so that I can read and code. I clicked on the Xcode icon that opened up the original instance, but that doesn't seem to do anything.
How do I get both things to stay open at the same time?
Answer: Follow these steps -
Step 1: On opening X-Code, this window turns up-
Step 2: On clicking Getting started with Xcode , gives -
Step 3: On clicking Start Developing with Xcode gives-
Step 4: On clicking the link - Xcode Workflow tutorial present in Write a Sample Application gives-
Notice that in all the process your Xcode menubar remains unchanged i.e.,
Now, Click on File(or Cmd + Shift + N keyboard shortcut) , and select New Project should pop up the windows as shown in Workflow tutorial. Select the application type, saving should bring you new Xcode project. Arranging the two windows side by side should look some what like this -
Now code while you learn from the Workflow tutorial :)
Hope this is helpful.
Answer: You can open the documentation window via Cmd-Option-? and search for Getting Started with Xcode there.  The option to open the documentation is also under the Help menu.
I generally open a project first and then open the documentation afterwards, if necessary.
Comment: Are you sure Xcode is in the foreground? Try going to Help > Developer Documentation.
Comment: I hit the Cmd-Option-? combination, but nothing happened.


Correct approach for angularjs modal transferring data to outer controller?

Question: Im wondering what is the correct approach about software design & best practice for angularjs modals.
In my application I have the main window which is using its own controller, and there I have a show(), hide() & destroy functions for the modal.
a button on my main window will show() the modal, there I'll have an isolate scope with variables inherited from parent scope, and its own controller.
I'd want to be able to pass an object to the dialog, in order to do a "modify" operation on it, and a "Create" button which closes the modal and creates a new object of the data entered in the modal.
Im facing two issues:
1. Inability to transfer the object from the scope in my main controller and the one in my modal controller, unless having 1 controller with a predefined object, and then I can add data to it (But why it works?)
2. Inconsistency with show(),hide(): The show() Would have to reside in the main controller, but since the modal has a controller of its own, it will have to implement the hide() & destroy(), which feels very bad to me in terms of code responsibility.
What is a good practice in such situations?
Comment: Write the modal as a directive. Write the modal as a service or use the `$modal` of angular bootstrap If you want to pass data to your modal you can do it by passing it as attr. Inject the service in your controllers and use service's open, close etc.
Comment: look at ngDialog for a nice implementation of what you are trying to do ... https://github.com/likeastore/ngDialog
Answer: Not sure if these are best practices, but they work...
1:
In my controller:
$scope.modelData = {};  // This will be loaded from an ajax call or set somehow

In my dialog directive scope:
scope: {
    ngModel: "="
}

In my html:
<dialog-directive ng-model='modelData'></dialog-directive>

2: I choose to pass in an object that the directive will assign the functions to.  You can then use this object in your controller to do things in your directive.
Controller:
$scope.dialogFuncs = {};

Directive:
scope: {
    ngModel: "=",
    dialogFuncs: "="
},
controller: ['$scope', function($scope) {
    $scope.dialogFuncs.openDialog = function() {
        // code to open the dialog here
    }

    $scope.dialogFuncs.closeDialog = function() {
        // close dialog code here
    }
}]

Html:
<dialog-directive ng-model='modelData' dialog-funcs='dialogFuncs'></dialog-directive>
....
<button ng-click='dialogFuncs.openDialog()'>Open Dialog</button>

Hope this helps.
Answer: You can use the $modal service of angular-ui bootstrap or write your own, write your modal as a directive and use the open, close methods of the service inside your controllers.
e.g.
 $modal.open({
     template: '<my-modal something="cool"></my-modal>'
 })

Your directive could be something like this
  restrict: 'E'
  replace: false
  templateUrl: 'yourhtml.html'
  link: ($scope, $element, attrs) ->
      if attrs.something is cool
        console.log('cool')
      else
        $scope.$close()


Qual a diferença na atribuição de uma matriz já iniciada para uma não iniciada?

Question: char nome[10];
nome = "w" //Aqui ocorre um warning, por quê isso ?

char nome_dois[10];
nome_dois[0] = "w" //  Aqui e normal,  como esperado.

"w" está em uma memoria estática?
nome[0] está  em uma memória dinâmica ou estática?
Quando chamo printf("%p", "w") me imprime um valor hexadecimal que é a representação do "w" então e uma constante em uma área estática?
Comment: A resposta resolveu sua dúvida? Acha que pode aceitá-la? Veja o [tour] se não souber como faz. Isso ajudaria muito indicar que a solução foi útil para você. Também pode votar em qualquer pergunta ou resposta que achar útil no site todo.
Answer:
char nome[10]; nome = "w" --- Aqui ocorre um warning, por quê isso ?

Você não está copiando o "w" para a área reservada para nome, a cópia é feita com a função strcpy(). Veja mais sobre em Diferença entre array de char e ponteiro de char e outras linkadas sobre o assunto. O warning  indica que está fazendo uma operação potencialmente errada, e de fato é errada mesmo.

char nome_dois[10]; nome_dois[0] = "w" --- Aqui e normal, como
  esperado.

Normal mais ou menos, até vai funcionar, mas pode ter situação que isto estoure a memória reservado para esta string.

"w" está em uma memoria estática? nome[0] está em uma memória dinâmica ou
  estática?

Sim, "w" está em área (efetivamente) estática. nome[0] está em área automática (que sempre acaba sendo o stack). Veja mais em Usar variáveis estáticas ou dinâmicas em meus códigos? O que seria mais eficiente ou melhor visto no mercado de trabalho? e Alocação dinâmica em C - alocando sem saber a quantidade total de elementos.

quando chamo printf("%p", "w") me imprime um valor hexadecimal que é a
  representação do "w" então e uma constante em uma área estática?

O que está imprimindo é o endereço(indicado por "%p") de onde está a string e o valor é constante em área estática. nesta área tudo é constante.
Comment: na verdade era pra ser nome_dois[10] = "w" por que da certo?
Comment: Isto está sem contexto
Comment: Desculpe ser estou sendo "burro" mas veja se as minhas definições estão corretas, o identificador de uma matriz unidimensional e um ponteiro que aponta para a pilha de dados e cada elemento dessa matriz e um ponteiro que aponta para uma area estática que contém uma constante ou e um endereço que contém uma constante que foi copiada da área estatística para área automática?
Answer:
"w" está em uma memória estática?

Sim, strings escritas "diretamente no código" são armazenadas numa área estática. Você pode usar essas strings como ponteiros ou copiando para buffers dinâmicos, por exemplo.
char nome[10];
nome = "w"; //Aqui ocorre um warning, por quê isso ?

Em C, a inicialização da variável e a atribuição são coisas diferentes, apesar de as duas coisas serem feitas com =.
char nome[10] = "w"; // copia a string estática "w" para uma variável na pilha (ou global)
nome = "w"; // usa a string "w" como ponteiro e tenta atribuir a um array (operação inválida na linguagem, dá erro)

Lembre-se dessa diferença quando disserem que C é uma linguagem simples e elegante :-)
Para fazer cópias de strings depois que a variável já está declarada, use strcpy ou memcpy.

nome[0] está em uma memória dinâmica ou estática?

Dependendo como nome foi declarado, pode estar numa área de variáveis globais, ou na pilha automática de chamada de funções. Esses dois são os casos mais comuns, mas na verdade pode estar em qualquer lugar, afinal, até "w"[0] é válido! (indexar uma string estática)
nome_dois[0] = "w"

Referenciar "w" no código nesta situação, como na maioria dos casos (exceto na inicialização, como visto acima), gera um ponteiro para a string estática. Se você utilizar operações de ponteiro em "w", tudo bem. Mas aqui você atribuiu o ponteiro a um char (um dos elementos do array), o que me deu a warning no GCC:

warning: assignment makes integer from pointer without a cast

(ele chama o char de integer porque chars em C são como inteiros pequenos)
Portanto, lembre-se de compilar com as warnings ativadas!
nome_dois[10] = "w"

Se fizer isso, vamos ter uma combinação de pequenos erros que podem levar a um belo desastre no seu programa. O primeiro erro é o mesmo de cima, conversão indesejada de ponteiro para inteiro e o segundo erro é escrever num elemento inexistente do array (se declarado com [10], ele vai de [0] a [9] — as maravilhas da indexação iniciando com zero...)