Convex Sets in Functional Analysis?

Question: Why did Bourbaki choose to study convex sets, convex functions and locally convex sets as part of the theory of topological vector spaces, and what is so important about these concepts?
I'd like to really feel the intuitive reason why they devoted an entire chapter to these things, to appreciate the necessity for studying them here and not somewhere else, why they are naturally related to semi-norms and weak topologies, and why lead to something so important as the Hahn-Banach theorem.
(Contents of the chapter viewable on amazon if necessary)
Edit - to be clear: I'm not interested in ex post facto justifications for studying convexity. You could make the same arguments about e.g. point set topology, missing the fundamental simplicity in the fact that topology is just about 'near-ness', ignoring how every single concept/theorem has a deep intuitive interpretation as such. I'm interested in the most core fundamental conception of convexity as it lies within the edifice of mathematics as a whole, in the sense that one would be able to derive the contents of the chapter themselves when viewed from the right perspective.
Thanks!
Comment: Though it sounds offensive, I must say that since you ask such question you should close Bourbaki and read something more down-to-earth.
Comment: There are useful in optimization
Comment: @Norbert it's not very helpful to come on a question and answer site, a) insulting me for asking a motivational question about one tiny part lying half-way through a massive collection of books notorious for eschewing motivation, b) telling me you know the answer, c) telling me you know why my answer is wrong, & d) not telling me why it's wrong. Do you consider this as a beneficial style of pedagogy, or even in the relative direction of advancing human knowledge? (Queue an answer with no justification)
Comment: You haven't seen a convex function in elementary calculus? Anything with $f''$ being positive? Functional analysis is not the only place where they are appear. But if you don't feel like reading that chapter, you should not. (As a matter of fact, I don't know why you are reading Bourbaki's book to begin with; this may be the real problem here.)
Comment: @Norbert I found the correct answer, a one-word answer. I wonder whether you know the one word that sums it all up (and why you didn't post that one word instead...).
Comment: You found one word that sums up years of work by dozens of the most prominent mathematicians of their time? I can't wait to hear it!
Comment: @bolbteppa I know that word, and it is a wrong answer.
Comment: What is the word, and why is it incorrect?
Comment: My first comment was helpful and reasonable. See two upvotes. Your next comment was "guess what I want to hear as answer" is stupid, therefore my tough second comment. And the last, if you came up with an answer, don't waste the time and efforts of other - just answer your question.
Comment: @Norbert There's absolutely nothing reasonable about a comment like that, it betrays serious ignorance of the book I was asking about, arrogance for a whole host of reasons, self-congratulation, and functions as the antithesis of pedagogy (on a Q&A site, no less). If you seem to think it's fine to waste time in delivering the answer and like to imply that to know it all without justifying yourself I guess I should follow your path, the path of one who knows more then me (so I can learn to know it all myself one day), this is your contribution to the world today, be proud.
Answer: Maybe the following can at least partly answer your question. First we look at

topological vector spaces in increasing generality:
\begin{align*}
&\text{finite dimensional vector spaces - Hilbert Spaces - Banach Spaces}\\
&\text{Frechet Spaces - locally convex vector spaces}\\
\end{align*}

as Jänich does in his Topology. There he mentions an example from Dieudonnes Treatise on Analysis Volume II of a locally convex, but not metrizable and so not pre-Frechet topologial Vector Space.

He states, that these non-metrizable spaces occur naturally in functional analysis for example when we want to find on a given topological Vector Space $E$ the weak topology, i.e. the coarsest topology, so that all continous, linear mappings are continous. He further states, that if $E$ is an infinite dimensional Hilbert Space, then $E$ equipped with the weak topology is already a locally convex Hausdorff Space, but not metrizable.

And now some deeper information about this natural wish to develop a theory around locally convex vector spaces.
Here's an extract from Bourbakis Elements of the History of Mathematics. He writes in the end of chapter 21: Topological Vector Spaces:

Excerpt from Bourbakis Elements of the History of Mathematics ch. 21:
It had on the other hand been observed, before 1930, that notions such as simple convergence, convergence in measure for measurable functions, or compact convergence for entire functions, are not capable of being defined by means of a norm; and in 1926, Fréchet had noted, that vector spaces of this nature can be metrizable and complete.
But the theory of these more general spaces was only to develop in a fruitful way in combination with the idea of convexity. This latter (that we saw appearing with Helly) was an object of study for Banach and his pupils, who recognised the possibility of interpreting thus in a more geometric way numerous statements of the theory of normed spaces, preparing the way for the general definition of locally convex spaces, given by J. von Neumann in 1935. $\ldots$
Finally and especially, it is certain that the main impulsion that motivated this research came from new possibilities for applications to Analysis, in domains where Banach Theory was inoperative: the theory of sequence spaces must be mentioned in this context, developed by Köthe, Toeplitz and their pupils since 1934 in  series of memoirs, the recent setting up of the theory of analytical functionals of Fantappié, and above all the theory of distributions of L. Schwartz, where the modern theory of locally convex spaces found a field of applications that is without doubt a long way from being exhausted.
Answer: Mathematics is always a fine line between imposing conditions that are

Strong enough to give you tools with which to show interesting results
Weak enough to cover interesting applications
Strange enough to not be easily analyzed or trivialized

The condition of local convexity happens to be

Strong enough to leave you with a rich dual theory, due to the separation results. This in turn leaves you with interesting results such as the Krein-Milman theorem and a means of defining integration. While these are interesting results in their own right, they also turn out to be tools the are generally applicable to other problems.
Weak enough to cover many applications to physics, PDE etc.
Strange enough that many unexpected things happen.
Answer: In my experience, convex sets are very important (at least in functional analysis and optimization) because of the various separation theorems that apply to them.
For example, if $A$ and $B$ are convex, closed subsets of a Banach space, and $A$ is compact, then there exist a linear functional $\ell$ such that $\ell(A)\le\lambda<\ell(B)$ for some $\lambda\in\mathbb{R}$.
Answer: One key idea is the connection between balanced absorbing convex sets and (semi-)norms. They are basically one and the same.
For every norm the unit ball under that norm is a convex set.
Similarly, any balanced bounded absorbing convex set generates a norm via the Minkowski functional (ie: how much do you have to scale the set to hit your point? Define that scaling factor as the norm of that point)
Answer: Besides the separation theorems, looking at this from the Krein-Milman and Choquet perspectives, the prettiness of the results alone justifies the importance of convexity, not to the mention their corollaries. Convexity requires a vector space structure...of course it is functional analysis.
As for semi-norms, they're immediate generalizations of norms. It's not that surprising that they characterize convexity.
Answer: To me, the primary relevance of convex spaces is in its very definition: When a space contains two points, it also contains the line segment connecting them.
As for convex functions, one justification at calculus level is the uniqueness of local minimum. The most interesting theorem in "real analysis" regarding convex functions is the Jensen's inequality which statement in its probabilistic form should make it interesting enough.

Convex Sets in Functional Analysis?


Mac OS X: How to force a Field Editor to scroll instead of wrap text?

Question: I have a Cocoa, Document-based Mac OS X application.
One feature that I have in my app is a list of text items which can be double-clicked to edit. When the user double-clicks one of the text items, I place the current window's fieldEditor text field over the clicked text item to allow editing.
Everything is working fine except for one problem. I cannot figure out how to make the fieldEditor text field clip + scroll rather than wrap its text. Here's what it currently looks like:

See how the text is wrapping to a second line? I don't want that. I'd like it to remain one line which scrolls (and appears clipped).
Here's an example of it working correctly on a list item which has less text:

Here's what I'm trying in my view controller:
NSWindow *win = [listItemView window];
NSText *fieldEditor = [win fieldEditor:YES forObject:listItemView];
[fieldEditor setFont:[TDListItemView titleFont]];
[fieldEditor setAlignment:NSLeftTextAlignment];
[fieldEditor setDrawsBackground:YES];
[fieldEditor setBackgroundColor:[NSColor whiteColor]];
[fieldEditor setString:str];
[fieldEditor setDelegate:self];
[fieldEditor selectAll:nil];

if ([fieldEditor isKindOfClass:[NSTextView class]]) {
    NSTextView *tv = (NSTextView *)fieldEditor;
    NSMutableParagraphStyle *style = [[[tv defaultParagraphStyle] mutableCopy] autorelease];
    [style setLineBreakMode:NSLineBreakByClipping];
    [tv setDefaultParagraphStyle:style];
}

CGRect r = [self fieldEditorRectForBounds:[listItemView bounds] index:idx]; // height here is 10.0
[fieldEditor setFrame:r];
[fieldEditor setNeedsDisplay:YES];
[[self view] addSubview:fieldEditor];
[win makeFirstResponder:fieldEditor];

Notice that part in the middle: I check to see if this fieldEditor is an instance of NSTextView in order to call the setDefaultParagraphStyle: method on it. This is my attempt to get the fieldEditor to clip its text -- via the NSLineBreakByClipping value. It's not having any effect. And I'm not even sure this is what I should be doing to get the fieldEditor to scroll on one line.
Also note that the height of the rect which I compute in my -fieldEditorRectForBounds:index: method is correct, and is providing a rect which is correctly sized for a single line of text (14.0 pixels in this case).
What am I missing to make the fieldEditor display a single line of scrolled/clipped text?

I've also tried adding these lines in the middle section:
    [[tv textContainer] setHeightTracksTextView:YES];
    [[tv textContainer] setWidthTracksTextView:YES];

This has the desired effect of resizing the visible portion of the fieldEditor which is good. But the bad news is that it doesn't change the fact that the text is still wrapped, rather than clipped + scrolled. :(

This seems related to this constant:
NSStringDrawingUsesLineFragmentOrigin

which can be used in the options: argument of:
-[NSAttributedString drawWithRect:options:attributes:]

but in my case, I'm working from a NSText field editor, not an NSAttributedString. I can't figure out how to do this sort of thing with an NSText field editor.
Answer: Hmmm ... NSTextView relies on an NSScrollView entirely for its scrolling behavior. I'm not sure if there's more to this that I'm not seeing, but it looks like the "historic" solution to your problem is either to:
Use A Different Control
You can use an editable NSTextField in its standard IB label configuration with editing enabled and scrolling selected as the behavior. It does all the heavy lifting for you already when configured properly - no need to mess around with the field editor directly.
...or to...
Cheat
Slap the field editor into an appropriately-sized and configured NSScrollView (allow only horizontal scroll; don't show the scrollers) dynamically, then remove the scroll view when finished editing.
Comment: If only more people at home would realize I'm right (even when I'm wrong), things would go so much more smoothly ... ;-)
Comment: Do these "at home" people *know* how high you StackOverflow reputation is? Maybe they should be reminded ;). Thanks for your advice. Your option number one turned out to be a relatively simple change, and gives me the behavior I want. Thanks again.
Comment: Not being of the nerd persuasion, my SO rep unfairly has no effect on arguments. SO. UNFAIR. ;-)
Comment: I have a feeling you are right. I was kinda hoping there was a simple method or two which I could call to get the behavior I wanted. But I'm increasingly convinced your answer here is correct.
Answer: NSMutableParagraphStyle* style = [[NSMutableParagraphStyle alloc] init];
[style setLineBreakMode:NSLineBreakByTruncatingHead];

NSMutableDictionary* attributes = [[NSMutableDictionary alloc] init];
[attributes setObject:style forKey:NSParagraphStyleAttributeName];

NSTextView* textView = [[NSTextView alloc] init];
[textView setTypingAttributes:attributes];

Answer: If you use NSTextView, please try below codes ....
[self.textView setMaxSize:NSMakeSize(FLT_MAX, FLT_MAX)];
[self.textView setHorizontallyResizable:YES];
[[self.textView textContainer] setWidthTracksTextView:NO];
[[self.textView textContainer] setContainerSize:NSMakeSize(FLT_MAX, FLT_MAX)];


Como usar o NPM e o Yarn no ASP.Net Core?

Question: Estou com dificuldade em utilizar o Yarn/NPM no ASP.Net Core.
Estou instalando pacotes da seguinte maneira: (Exemplo instalando o JQuery)
Yarn: yarn add jquery
NPM: npm install jquery
Ocorre tudo normalmente, o problema é que os arquivos vão para a pasta node_modules, enquanto que no ASP.Net Core é "preciso" que os arquivos estejam na wwwroot.
Eu adoraria utilizar o Bower, já que tem como definir o diretórios das instalações, porém ele não está funcionando e está recomendando o uso do Yarn.
Então como eu conseguiria instalar os pacotes a modo de utilizar no ASP.Net Core?

Se possível, eu gostaria que os arquivos fossem instalados na wwwroot/lib.
Eu pesquisei, porém só encontrei algumas coisas em inglês, mas eu sou horrível em inglês e os tradutores dos navegadores não parecem ser tão melhores assim, fica tudo confuso.
Comment: Vinicius, fazer o setup do npm ou yarn eh facil mas pra copiar pro wwwroot vc tem q usar algo como webpack
Comment: @FabriDamazio Utilizei o Gulp pra retornar isso, mas vou ver sobre o WebPack, talvez ele tenha uma forma melhor de se fazer isso. Muito obrigado :D
Comment: @ViníciusLima alguma novidade?
Answer: Para isso, é possível usar a flag --modules-folder:

yarn install --modules-folder <caminho>
Especifica um local alternativo para o diretório node_modules, ao invés do padrão ./ node_modules.

Então no seu caso, você poderia instalar o jquery usando o seguinte comando:
$ yarn add jquery --modules-folder wwwroot/lib
Aí, sua estrutura de pastas deve ficar mais ou menos assim:
pasta_raiz
├── package.json
├── wwwroot
│   └── lib
│       └── jquery
│           └── ...arquivos do jquery
└── yarn.lock

Porém, à medida que você for instalando mais e mais pacotes do npm, pode ficar um pouco cansativo ficar digitando essa flag com o caminho toda vez.
Pra "automatizar" a digitação dessa flag (e de qualquer outra que você precisar usar globalmente no seu projeto), você pode adicionar um arquivo .yarnrc na pasta raiz do seu projeto com o seguinte conteúdo:
--modules-folder wwwroot/lib

Depois disso, basta usar normalmente os comandos yarn, yarn install ou yarn add <pacote> e os módulos já serão salvos automaticamente na pasta ./wwwroot/lib do seu projeto.

A propósito, a documentação do Yarn já está 100% traduzida para português brasileiro, agora ficando mais fácil entender e aprender sobre o Yarn \o/


how to check the csv contain a specific column header in ruby using fastercsv

Question: I have a csv file contains values as:
"UID","NAME","USERNAME","ROLE","ADDRESS"
12,"Joe","joe_123","A","address1"
13,"Lee","lee_321","U","address2"

I need to check existence of column heading "UID" and "USERNAME" in the csv file. I am using ruby and fastercsv gem.
Please help me how to write this checking using fastercsv. Thanks in advance
Answer: I think you can read the content of csv file with this:
FasterCSV.foreach("path/to/file.csv") do |row|
    # use row here...
  end

than you can use header? and headers() methods to determine headers. Vizit http://fastercsv.rubyforge.org/ if you need additional information.
Comment: Thank you Ryaz. Now I can use headers() for getting headings


Sampling weights in R

Question: I am using a dataset (National Longitudinal Survey of Labor Market Experience, 1997 Youth Cohort). The data set contains sampling weights already calculated. How do I incorporate these weights in point estimation in R (e.g., means, proportions etc.)?
Comment: As written, this question doesn't seem to be [on-topic](http://stats.stackexchange.com/help/on-topic) for CV (we generally don't do "how do I code this in R"). On the other hand, I'm not sure the question is currently suitable for transfer to Stack Overflow (perhaps it would help if it included a code sample, even if it's just an extract from the data frame). It's a nice question, I think ultimately its mostly likely final home is SO.
Answer: From the package survey, univariate statistics are produced with svymean and svyvar. You'll need to create a svydesign object first.

Sampling weights in R


How to learn piano to a high level without any money or piano at home?

Question: By the end of 2019, I want to learn piano at a level where I can play proficiently. I have no money that I can spend to get a teacher or get practice books. I do not own a piano, but I still can play one at a public place during the weekdays.
I'm actively playing violin and have been doing so for seven years. However, I barely know anything even closely related to music theory. I can read notes but I don't know what they are called.
I understand the amount of time I have to put in piano to play it decently, and I'm willing to put that amount of time, but I'm not so sure where to start.
Comment: Hi Jack, welcome to the site! Excuse me for being a little skeptical, but this seems to be asking a little much, don't you think? Imagine someone asking how to learn to construct "relatively hard" pieces of furniture, but they've never woodworked before, they don't have money for wood, they have no mentor to teach them, and they don't even have tools (but they have access to a public shop during the week). Oh, and they only have a year to learn! It's a bit of a tall order, don't you think?
Comment: I see a whole lot of ambition here, but not much practicality. If it were easy, a lot more folks would be doing it that way. It usually takes time to develop skills.
Comment: How long can you play that piano in the public place during the weekdays? Do people boot you out within half an hour, for example?
Comment: To clarify what "proficient" means, I want to be able to play relatively hard Chopin pieces. I'm certain that I won't have any motivational problems because I genuinely like music and nothing's forcing me to learn piano in the first place.
Comment: It's possible you wouldn't be able to play hard Chopin pieces by the end of 2019 even if you were a billionaire. It can take years to become proficient at any instrument. That said, can you practice for eight hours a day, seven days a week? And study music theory outside of those hours? If so then it might be doable.
Comment: @Dom - do you think there is any other realistic option to Laurence Payne's suggestion? Deleting that answer suggests so. What is it?
Answer: With the limitations in mind, there's not so many options. You can learn theory online. There are lots of good resources for that. You can also find lots of piano tutorials online.
I guess you have access to a printer? Then you can print scores to practice from. If you do not have access to that, well copy scores you find online by hand.
Answer: Have you heard the saying that you need to do 10,000 hours of practice to become proficient at something?  Ok it may not always be true but it's a yardstick that is appropriate here I think.  Being able to play "relatively hard Chopin pieces" with any proficiency will put you into an upper bracket of pianists generally.  Many of us have taken many years to get to that level of performance.
So 10,000 hours:  that's 8 hours a day for 1250 days (well over three years even if you do it every day).  Do you have the capacity for that as well as the facilities?  It just seems unrealistic to me.  And if your deadline is the end of 2019 then you do not have that many days anyway.
So sorry but this just does not seem possible.
Answer:
If you have a phone/PC, install piano apps and practice daily.

Learn with piano tutorials from online and practice on the app and on the public piano.

Learn music theory from online ( try to cover topics like major/minor scale degrees, circle of fifths, music notation, time signature, key signatures, clefs, chords, chord progressions, rhythm, piano accompaniment patterns)
Some example piano melody and chords here
Answer: You have no money and weekends are available.
So you need to buy hours to not just play weekends because you need to learn intensely 15-30 minutes at a time with whatever time between.
Yes, I know you didn't ask about time but if you want maximum learning then one solution to work weekends and instead play everyday at home using a portable keyboard ... commonly on Craigslist, eBay and thrift stores such as Goodwill.
For example...
https://philadelphia.craigslist.org/msg/d/yamaha-psrkey-portable/6722119679.html
https://philadelphia.craigslist.org/msg/d/yamaha-ps-400-portasound/6741493429.html
Answer: Is there a reason why you can't have a digital piano at home, apart from money? If money is the issue, work a couple of weeks at some minimum-wage job to save 300-400 bucks, which the range where acceptable-quality digital pianos start (second-hand ones might even be cheaper). Having one available in the evenings and weekends will be invaluable if you're serious about this.
Check if your local public library has any sheet music and instructional books.


Unable to route ports, ISP assigned private address - connection down issues every 4 hours

Question: I have a big problem, I live in an area where there is no fiber or ADSL connection and I connect to the internet using a 4g+ sim in a 4g+ router (Tp-Link Archer MR600).
The connection is just fine: ping ~50ms - dw 240mb - up 50mb but there are a couple of issues that are driving me crazy.

My ISP does not assign me a public static IP, I have a private IP maybe they are using a double NAT or CGN, I don't know.
My connection goes down and up, every 4 hours, they do some sort of IP update for I don't know what reason.

I can't open doors, host anything, access video surveillance cameras remotely and a lot of other things.
I am paying a lot of money for the contract, and this is the only ISP with decent bandwidth and stability, but what I have listed above prevents me from doing a lot of operations. For example if I am connected to a VPN every 4 hours the connections are interrupted, and I have to reestablish it manually.
Maybe (surely) there is someone here who has a better knowledge and I will be happy if someone wants to give me some clarification or even better some tricks to make things work.
Ask me if you need some kind of output I will post it.
As another note feel free to give any suggestion, I don't know what can be useful. Some kind of connection mesh, VPN or any other solution should work I will give it a try.
Maybe could be a wrong configuration or something similar but I don't think so, the ISP is locking me in some way.

Things that I tried:

IP address reservation
Connecting 2 routers in cascade
MAC address cloning
DMZ
Static routing

Thanks.
Comment: Your ISP is supposed to tell you how to setup your router.. and if they really are not letting you use IPv6 by now, switching to an ISP from the current millennia might be preferable anyway.
Comment: Yes you are right, reading here and there I got the same idea. Anyway when i try to detect my IPV6 I get N/A. On my router I selected IPV4 as PDP type because if I select IPV6 it doesn't work, not astablishing any connection. Maybe the ISP doesn't support it at all. Or are you referring to something that I'm not understanding when you says: "You might be able to avoid it if all direct connections/VPNs are configured to prefer IPv6 addresses"? Thanks for your time
Comment: Yes configuring VPNs and other stuff like this might be work. But for example I'm kicked out while playing on some game or if I'm live streaming. this is a real pain. I would pay to have at least a public IP but apparently the ISP just doesn't want to know, when I talk to the operators they don't even know what I'm asking. I've tried other ISPs and burned a lot of money but this is really the only one with a decent bandwidth. weird situation
Comment: Just for a laugh: one of the ISP provides a radio connection (FWA), but here the signal is bad because "there is a big tree between your house and the bts". They first activated the contract and then canceled it because the technician said there was a tree. (Yes, I live in southern Italy) :D
Answer:
Many ISPs in their basic contracts simply have a limited consumer internet user in mind and will purposefully break things for everyone trying to use their uplink as a proper internet connection.

You might be able to switch your contract to one geared towards hosting.

Many ISPs stopped caring about getting everything right for IPv4 users as soon as IPv6 became preferred and thus their carrier-grade NAT solutions for using their limited IPv4 pool will simply break everything but the most simple use cases.

Avoid CGNAT limitations by using IPv6: if necessary, configure your VPN client to prefer IPv6

Manage your expectation. 4G is not a cable: Phone companies expect that they can online/offline towers however they please because phones can generally deal with that. Atmospheric influence on 4G is only partly mitigated.

Because of the uplinks inherent limitations in terms of reliability, making sure your VPN client can swiftly reconnect and just living with the occasional latency spikes may be more cost-effective than convincing your ISP to become as reliable as few other 4G customers are willing to pay for
Comment: Thank you for yor time and good explanation. Maybe you are right I have to mitigate my expactations, maybe I'm expecting too much. I'll make another call to see if it is possible to switch to any business plan, I called to ask for a public IP and nothing but maybe there is some other plan that the operator hasn't told me about.
Comment: If the ISP is not telling you your options, you may be calling a consumer hotline.. most ISPs know there is little point in offering huge-upfront-fee contracts to non-incorporated entities. Thus the consumer-facing support personnel is not instructed to respond to business needs.


Calculating norm of ideal

Question: I'm trying to figure out how to calculate the norm of an ideal, I know the answer for the below is 2.
$N_{\mathbb{Q}(\sqrt{-17})}(\langle 2, 1+\sqrt{17}\rangle)$.
I do realise $\mathcal{O}_{\mathbb{Q}(\sqrt{-17})}=\mathbb{Z}[\sqrt{-17}]$, and that $a+b\sqrt{-17} = a-b+b(1+\sqrt{-17})$ for $a,b \in \mathbb{Z}$. But why the only elements of $\mathbb{Z}[\sqrt{-17}]/\langle 2, 1+\sqrt{17}\rangle$ are only $0$ and $1$?
Many thanks!
Answer: Here is a way of calculating these things:
The norm of an ideal $I$ in $\Bbb Z[\sqrt{-17}]$ is given by $N_{K/\Bbb Q}(I) = (\Bbb Z[\sqrt{-17}] : I)$ (the index of $I$ in $\Bbb Z[\sqrt{-17}]$).
You have
\begin{align*}\Bbb Z[\sqrt{-17}]/(2, 1 + \sqrt{-17}) &\cong \Bbb Z[X]/(X^2 + 17, 2, 1 + X)\\ &\cong \Bbb F_2[X]/(X^2 - 1, 1 + X)\\ &\cong \Bbb F_2[X]/(1 + X)\\ &\cong \Bbb F_2,\end{align*}
i.e. $N_{K/\Bbb Q}((2, 1 + \sqrt{-17})) = 2$. (Note this also shows that this ideal is a prime ideal).

Calculating norm of ideal


Erro compilar robocode

Question: Boa tarde!
Estou tendo problemas ao compilar o Robo de exemplo no Robocode, onde é apresentado o erro abaixo:

Compiling... Unable to load annotation processing manager
  org.eclipse.jdt.internal.compiler.apt.dispatch.BatchAnnotationProcessorManager
  from classpath.
Compile Failed (-1)

Muito obrigado.
Comment: E cadê o código que gera esse erro? Clique em EDITAR e adicione ele a pergunta.]
Answer: Esse erro acontece mesmo com o código 100% funcional.
Para resolver, vá em

Source Editor > Compiler > Options > Preferences

A opção do meio, "Compiler Options" possui diversos atributos, pode apagar todos sem dó, neles estão vários atributos que só funcionariam se o código estiver dentro do eclipse, o que não é o caso.
No lugar coloque apenas o texto (com o traço antes):
<code>-verbose
</code>

Erro compilar robocode


How can I write this out in CSS?

Question: Go to the Grid Spacing Styles section. Create a style rule to apply the Border Box model to the div elements belonging to the following classes: container, row, classes that begin with column, cell, and a elements nested within div elements belonging to the cell class.
I have tried everything I can think of and nothing works. *
Comment: _"I have tried everything I can think of and nothing works"_ - then start by showing us _what_ you tried, and also explain your reasoning behind it. And if you are having trouble with specific parts (like maybe _"classes that begin with column"_), then do some research on that.
Comment: Is this homework?
Comment: Honestly, yes. But I have no idea how to do it and the instructions make NO sense. This is my first time ever doing coding. I'm not asking for you guys to do this for me. I'm asking if y'all can help me...
Comment: I appreciate your honesty although that's not what Stack Overflow is for. Has your teacher shown you any css in class before?
Comment: We have an online book to read but it doesn't talk about applying border boxes.
Comment: Welcome to SO ;) Thou we are not here to do your homework - your honesty deserves some effort from our community since your teacher obviously failed in tranporting the general concept of html and css to you. So lets show our new member some basics ;)
Comment: Google "Border Box model", first result: https://css-tricks.com/box-sizing/ - so they apparently want you to apply `box-sizing: border-box` to all the elements mentioned.
Comment: @iLuvLogix I like that approach, I will write up an answer that tries to explain the concepts so that this user can solve it on their own.
Comment: @Alexander De Sousa Yeah - lets do it ;)
Comment: -webkit-box-sizing: type;
-moz-box-sizing: type;
box-sizing: type;   This is the only Border box option the book gives. I tried it and it did put spaces between the pictures but the grading system says it's not right.
Comment: let's not welcome a new user with dozen of downvotes - let us rather explain him/her how things work ;)
Answer: HTML and CSS work together to make the visual web that you see. They are responsible for 2 key parts,
HTML is the structure, much like the bricks, cement of a building. While CSS is the visuals that go on top like the paint colour and pictures on the wall.
Let's start with a short example this a heading and paragraph

Heading level 2

Our first paragraph

This will appear as probably just black text on your computer, we can add some flair with CSS, which are almost like spoken rules, so if we wanted to say "Let's make every paragraph text colour red" we could achieve this with:
p {
    color: red;
}

We can dictate many visual features by adding more rules:
p {
    color: red;
    font-weight: bold;
}

Let's say we had multiple paragraphs, we might want to differentiate one of them this is where we can use "classes", you add a class to HTML like so:

Heading level 2

Our first paragraph

Our second paragraph

Our third paragraph

Our fourth paragraph

Then in CSS you can pick it up with a similar fashion to before but prefixed with a period.
.special {
    color: blue;
}

At the moment we could add the special class to almost anything and it would make the text blue, but maybe we don't want that such as:

Heading level 2

Our first paragraph

Our second paragraph

Heading level 2

Our third paragraph

Our fourth paragraph

We might not want our h2's to be blue as well so we can target only specific HTML elements like so:
p.special {
    color: blue;
}

h2.special {
    color: purple;
}

Now the "special" class acts differently depending on which element it's applied to.
Coming back to your example, we can break this up a little:

Create a style rule to apply the Border Box model
Apply this to the div elements belonging to the following classes: container, row classes
classes that begin with column, cell
a elements nested within div elements belonging to the cell class.

Now we have 4 distinct tasks that we can build up to incrementally.
I think you have already figured out that the border box model is a property, this makes various elements behave in a slightly more sane way. i.e. the intuitive way you'd expect things to work is not what is default hence the need to correct into the border box model.
This property also needs to work across multiple browsers so you can start like so:
* {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}

Although here we've applied it to everything using the asterisk. Step 2 is to restrict this down a little bit, so the same way we restricted our special class to specific elements you'll need to do the same here.
Remember you can have multiple rules if you separate them with commas such as:
.class1, .class2 {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}

Part 3 is a little more vague but I think it means classes like column-1 or cellular, this brings us to an interesting feature of CSS, you can do some pretty basic regex-like operations in your css like so:
div[class^='startingwith'] {
  color: pink;
}

Which would work for only the first 2 divs. Take note of the ^ character, in many applications this means "starting with", not just CSS.

Hello world

Hello world

Hello world

It's also worth noting that you can omit the word "div" and then this would apply to any element that has a class starting with the specified name.
The final part of your question is trying to show you how you don't just target things directly by calling a class, you can work out context and only apply styling when a particular structure of HTML has been followed, for example:

Main paragraph at the start

Other lesser paragraphs...

Other lesser paragraphs...

You can target the paragraph that is nested simply be separating rules with spaces:
.intro p {
  color: crimson;
}

Now only the paragraph that is WITHIN .intro will be styled with crimson, you can apply this logic to do the same for anchor tags .
Comment: Okay, I've done other coding assignments similar to that before.
Comment: upvote for your effort ;)
Comment: I understand how to format sentences but I really need some help with my border box and div elements. Once again, not asking you guys to do it for me. I just need some help. This is my first semester EVER taking web development.
Comment: @HappyPumpkin no problem, I'm just editing more info in now, I won't solve it but I'll get you up to speed.
Comment: @iLuvLogix thanks buddy.
Comment: @HappyPumpkin I have now edited in all the concepts that you will need to use, but it will still be up to you to take that and apply it to your work.
Comment: This question is now on hold, that's why I wanted to get my answer in quickly. I appreciate we have rules to follow on SO, but I figured this question was okay to be the exception. :)
Comment: Thank you so much! I am going to try this out :) Sorry for the late response, I was finishing up another project.
Comment: @HappyPumpkin Did this help you out?
Comment: Yes, Thank you =D I'm still in the process of trying to find out how to apply the border box to the div elements though

How can I write this out in CSS?


Fulltext search on mysql with a 3 letter word

Question: I'm trying to find "the zen" string in a field containing "The Zen Circus".
I've got a FULLTEXT index.
select url,name,
,   MATCH(name) AGAINST ( 'zen*' IN BOOLEAN MODE) as A
,   MATCH(name) AGAINST ( '"the zen*"' IN BOOLEAN MODE) as B
,   MATCH(name) AGAINST ('>the* zen' IN BOOLEAN MODE) as C
,   MATCH(name) AGAINST ('thezen*' IN BOOLEAN MODE) as D
,   MATCH(name) AGAINST ('cir*' IN BOOLEAN MODE) as E
,   MATCH(name) AGAINST ('circus*' IN BOOLEAN MODE) as F
from pages where url='thezencircus'

I've got this result:
url = thezencircus
name = The Zen Circus
A = 0   (why?)
B = 0   (why?)
C = 0   (why?)
D = 0   (ok)
E = 1   (ok)
F = 1   (ok)

I've also putted ft_min_word_len = 2 in the msyql config file.
Any idea?
Answer: See this answer MySQL full text search for words with three or less letters

[mysqld]
  ft_min_word_len=3
  Then you must restart the server and rebuild your FULLTEXT indexes.

Remeber to restart and rebuild indexes.

Edit
Run show variables like 'ft_%'; to confirm that the word length matches what you set it to.
Comment: I've done everything you said, thank you, but the problem is still here. :-(
Comment: Try running REPAIR TABLE pages QUICK; Also, just to make sure you got it right, on setting the ft_min_word_length: http://lostquery.com/questions/196/how-do-i-enable-short-3-letter-full-text-search-in-mysql is this how you did it?
Comment: Also, see my edit on how to confirm the value of the ft_min_word_len
Comment: Stupid! It works! thank you for the support, the server was not restarted (the hosting provider told me he did it, but he didn't!)
Answer: Kao is right but that didn't help me at all - why? InnoDB table uses a different setting - try updating this one and checking it with:
    show variables like 'innodb_ft_min_token_size';

Comment: Yep, that was my issue.  ft_min_word_len was already set to 2 before I even created my indexes, but setting innodb_ft_min_token_size as well and then restarting the server and deleting and recreating the index worked.  Thanks!
Answer: SELECT *, MATCH (title) AGAINST('$aranan*' IN BOOLEAN MODE) AS score FROM vod WHERE MATCH (title) AGAINST ('$aranan*' IN BOOLEAN MODE) ORDER BY score DESC LIMIT 10
Comment: Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer).


Why does the random number never equal 4.0?

Question: I'm trying to generate random numbers with up to 2 decimal places until one equals 4.0, but it's never ending.
count = 0

while(random != 4.00):
    print(round(random.uniform(0.00,4.00),2))
    count = count + 1
    if random == 4.00:
        print('DONE')
        print(count)

Comment: `random` is the `random` module, not any of the random numbers you're generating. A module will not equal `4.00`.
Comment: @ReinstateMonica Is it? At the very least we're missing the import for random, although there could always be more.
Comment: Please provide a [mcve].
Comment: I'm voting to close this, I can't see it ever being relevant in the future.
Comment: @AMC this **is** an MRE, but I agree that this likely won't be helpful to others
Comment: @AMC import statements are very often left out in questions (for the worse), so when a variable uses the name of a common module/package, it is usually safe to imply the variable refers to that module/package.
Comment: @ReinstateMonica Agreed!
Answer: You're not testing the random number you're generating. You need to assign it to a variable and test that.
while True:
    r = round(random.uniform(0.00,4.00),2)
    print(r)
    count = count + 1
    if r == 4.00:
        print('DONE')
        print(count)
        break

Answer: The statement while random != 4.0 is checking if the module named random is not equal to 4.0, not the number generated on each loop.
To fix this you need to use a variable:
import random
count = 0

while True:
    n = round(random.uniform(0.00,4.00), 2)
    count += 1
    if n == 4.00:
        print('DONE')
        print(count)
        break


Resistance change on the GST of a keyboard YPG235

Question: Is it possible to increase the resistance of the keys on YPG235 to make the keys a little heavier?
Answer: No. Any keyboard will either have the keys be weighted or unweighted. It is a physical feature of the keyboard just like the number of keys a keyboard  has and it cannot be changed. It's a big thing to consider when getting a keyboard.


Java hashing passwords

Question: I am trying to make a loop that gets passwords from an array list, hashes them, and then passes the hashed passwords back into a Person object.
import java.util.ArrayList;

public class CompanyDatabase    {

public ArrayList<Person> getPeople() {
    ArrayList<Person> people = new ArrayList<Person>();
    String[] u = {"Joe","Stan","Leo","John","Sara","Lauren"};
    String[] p = {"pass4321", "asdfjkl", "genericpw", "13579", "helloworld", "companypass"};
    for(int j = 0; j < u.length; j++){
        Person temp = new Person(u[j],p[j]);
        people.add(temp);
    }
    return people;
}
}

import java.util.ArrayList;
import java.util.Scanner;
public class CompanyDatabaseDriver {
    private static Scanner scan = new Scanner( System.in ) );
    public static void main(String args[]) {

            CompanyDatabase bcData = new CompanyDatabase();
            ArrayList<Person> people = bcData.getPeople();

            Hash_SHA hasher = new Hash_SHA();

            for(int i=0;i<people.size();i++){

                 System.out.println(people.get(i).getPassword());
            }
             // i know i have to use a variation of
             // String hashString = hasher.getHash(passString);
             // but do not really know what to do with it

   }

}
public class Person {

private String username;
private String password;

public Person(String un, String pw){
    username = un;
    password = pw;
}

public void setUsername(String un){
    username = un;
}

public void setPassword(String pw){
    password = pw;
}

public String getUsername(){
    return username;
}

public String getPassword(){
    return password;
}

}
Currently I just have the loop printing out the plain text passwords and then ending the loop.
Any help would be amazing. Thank you very much.
Comment: There's a simple example here: http://www.anyexample.com/programming/java/java_simple_class_to_compute_sha_1_hash.xml
Comment: Similar question here: http://stackoverflow.com/questions/3103652/hash-string-via-sha-256-in-java
Answer: You can use SHA1 diggest. See the example of creating a diggest from plain string below.
(You weill need to pass the byte[] of your plain password to the SHAsum(). I assume that you are familiar with String.getBytes() method)
import java.security.MessageDigest;

public static String SHAsum(byte[] convertme) throws NoSuchAlgorithmException{
    MessageDigest md = MessageDigest.getInstance("SHA-1");
    return byteArray2Hex(md.digest(convertme));
}

private static String byteArray2Hex(final byte[] hash) {
    Formatter formatter = new Formatter();
    for (byte b : hash) {
        formatter.format("%02x", b);
    }
    return formatter.toString();
}

Use the methods above to hash the passwords and store in the Person class the hashed value (SHA1)
Answer: I would suggest to have a look at MessageDigest. Get the instance you want, transform the password into bytes[] (using getBytes("UTF-8");) and retrieve the digested bytes. You can then turn your bytes into a string by converting them to hex values.

Java hashing passwords


Is there any relationship between remainder obtained through modulo 2 binary division and remainder obtained in a normal decimal division?

Question: For some cases, modulo 2 binary division is giving the same remainder as a base 10 modulus but for some cases it is not. Is there some relationship between the two remainders?
Example:-
<code>1.) q = 101000110100000
p = 110101
modulo 2 binary division remainder = 01110
and  In base 10,
q = 20896
p = 53
and q%p = 14 which is the same as 01110

2.) q = 11001001000
p = 1001
modulo 2 binary division remainder is 011
and In base 10,
q = 1608
p = 9
and q%p = 6 which is different from 011.
</code>
So is there some relationship or it is totally unrelated? I want to know if I can derive base 2 modulo division remainder by doing decimal modulus.
Comment: The numbers themselves do not depend on the representation you choose to use, be it decimal, binary, or roman numerals for that matter. The quotient and remainder are *numbers* defined by the Euclidean division rules, so if you get different results in different bases then you must be doing something wrong. What you posted is not enough to tell where exactly you went wrong.
Comment: This is the method i followed for modulo 2 binary division https://en.wikipedia.org/wiki/Cyclic_redundancy_check#Computation . I am trying to compute the CRC. Here are my steps https://imgur.com/a/cL5vH9Q
Comment: Sorry, not sure what that's supposed to mean. Try to write the decimal equivalent side-by-side, and it should become apparent where they diverge.
Answer: The ramainder doesn't depend upon the base that you choose to express it. Given two natural numbers $p$ and $q$, the remainder of the division of $p$ by $q$ is the only number $r\in\{0,1,\ldots,q-1\}$ which can be written as $p-d\times q$ for some non-negative integer $d$.
Comment: I am sorry, I meant I am doing modulo 2 binary division(like we do in calculation of CRC where we use XOR instead of subtraction) in the first case and normal division in the second.
Comment: Also, you can check , in my second example, the two methods are giving different remainders
Comment: In your second example, the remainder is $6$, not $3(=110_2)$.
Comment: I a certain that the remainder is 011, also, please note i am doing modulo 2 binary division. Here are my steps, https://imgur.com/a/cL5vH9Q . Also, this is similar to a crc calculation which is mentioned here https://en.wikipedia.org/wiki/Cyclic_redundancy_check#Computation


How to identify failed drive/port on 3ware card

Question: I have a 3ware 9650-SE controller with 2 drives in RAID-1 configuration. The drive on "port 1" has an error but the drive cages aren't labeled. I tried using the cli to "identify" the drive but tw_cli just spits out "N/A". I thought this might blink the drive activity LED but no:
# tw_cli /c7/p1 set identify=on
Setting port Identify on /c7/p1 to [on] ... N/A

How can I blink the drive activity of the individual port to find out which drive in the array is the one which is bad?
Answer: Found a way to do it using the "show all" command on a shell loop:
# while [ 1 ] ;do  tw_cli  /c7/p0 show all; done

This creates sufficient access to the individual drive (p0) to blink the light on the drive bay.
Comment: Same problems here… Thanks for the neat workaround.
Answer: Now, if you happened to inherit a Windows Server with a 3ware RAID card, you can do something similar with powershell:
PS C:\Users\Administrator> while ( 1 ) { tw_cli /c7/p0 show all }

And, when you have replaced the drive and want to see the rebuild status, you can use the same trick to get something similar to the watch command in Linux:
PS C:\Users\Administrator> while ( 1 ) { clear ; tw_cli info c7 ; sleep 5 }

HTH.


Check if ajax in the preprocess_node

Question: There seems to be a problem when I check if the node is served by ajax or not, I use this function :
<code>function mytheme_preprocess_node(&$variables) {
    if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
        $variables['is_ajax'] = true;
    }else{
        $variables['is_ajax'] = false;
    }
}
</code>
The same code works great with preprocess_page or preprocess_html
Is there a way to make it work? or eventually get the page/html variable in the node preprocess ?
Thank you !
Comment: maybe just check if current path is system/ajax
Answer: The node is cached and this function is only called for the first time the node is displayed for the given view mode.
If you really need to vary your output between ajax and non-ajax context, you need to add a cache context for that. See https://www.drupal.org/docs/8/api/cache-api/cache-contexts and the other related documentation pages. You could use the header:NAME-OF-THE-header cache context I guess.
As an alternative, do whatever needs to be done differently with ajax vs not  with Javascript/CSS

Check if ajax in the preprocess_node


Alternate ways to find the limit of a given sequence

Question: I need to find the $\lim_{n\to\infty}\{x_n\}$ where $\{x_n\}$ is defined as $$\{x_n\}_{n\ge1}=n^{\frac{1}{n}}\;,\;n\in \mathbb{N}$$
Now if I had a function $f:\mathbb{R}-\{0\}\to\mathbb{R},\quad f(x)=x^{\frac{1}{x}}$, then I could easily find it's limit as follows:
$$f(x)=x^{\frac{1}{x}}\\taking\,natural\,logarithm\,on\,both\,sides\\\ln{f(x)}=\frac{1}{x}\ln(x)\\Let\,\lim_{x\to\infty}\ln{f(x)}=L\;then\\L=\lim_{x\to\infty}\frac{1}{x}\ln(x)\\Applying\;L'Hospital's\;Rule\\L=\lim_{x\to\infty}\frac{1}{x}=0\\\Rightarrow\lim_{x\to\infty}{f(x)}=1$$
Since my sequence is clearly a subset of this function, it's limit is also 1. However, I am worried that this method may not be 'rigrous' enough. Is there any other way to find the limit of this sequence?
P.S: I tried finding the limit using the $\epsilon-N$ definition of a limit, but could not do so.
Answer: Your method is plenty rigorous. If $f(x)\to 1$ as $x\to\infty$, then of course the sequence $f(n)$ also tends to $1$ as $n\to\infty$. Indeed, for any $\epsilon$ there exists an $M$ such that if $x>M$ then $f(x)$ is within $\epsilon$ of $1$. Thus for any $\epsilon$, pick an integer $N>M$, and we will have $f(n)$ within $\epsilon$ of $1$ whenever $n>N$, which is the definition of the limit of a sequence.
Answer: We can use the fact that if $a_n>0$ for all $n\ge1$ and the sequence $\frac{a_{n+1}}{a_n}$ converges in $[0,\infty]$, then
$$
\lim_{n\to\infty}a_n^{1/n}=\lim_{n\to\infty}\frac{a_{n+1}}{a_n}
$$
(see this question).
We have that
$$
\lim_{n\to\infty}\frac{n+1}n=1
$$
and
$$
\lim_{n\to\infty}n^{1/n}=1.
$$
Answer: Check out these answers on this site:
Find $\lim_{n\to\infty} \sqrt[n]{n}$
Show that: $\lim\limits_{n\to\infty} \sqrt[n]n = 1$
There was another beautiful solution on this very site that used the AM-GM inequality but I can's seem to find it now. The gist of it was to write,
$$ (n)^{\frac 1 n} = (\sqrt n \cdot \sqrt n \cdot 1 \cdot 1 ... \cdot  1)^{\frac 1 n } \le \dfrac{\sqrt n + \sqrt n + 1 + 1 + . + 1 }{n} = \dfrac{2\sqrt n  + n - 2 }{n} = \frac{2}{\sqrt n} - \frac{2}{n} + 1 $$
Now since $ \lim  \dfrac{2}{\sqrt n} = \lim \dfrac{2}{n} = 0$, the limit on the right is $0$. Your result follows from applying the squeeze theorem.
Answer: Alternatively, for $n > 1$ we have $n^{1/n} > 1 $.  Using Bernoulli's inequality,
$$n^{1/n} = 1+a_n,\,\, (a_n > 0)\\n = (1+a_n)^n > \frac{n(n-1)a_n^2}{2}$$
Then
$$a_n < \sqrt{\frac{2}{n-1}}< \epsilon$$
for all $n$ sufficiently large, and
$$|n^{1/n}-1| = a_n < \epsilon.$$
Answer: For your information, the method you used is completely rigorous assuming you know the following fact:

If $\lim_{x\to\infty} f(x) = L$ then the limit of the sequence $f(1)$, $f(2)$, $\dots$ is $L$.

The first limit is taken over real numbers and the second over integers.
Try proving this fact if you have not seen it before. Is the converse true?


ps aux | grep result depends on terminal size on FreeBSD

Question: From experimenting, it seems that even when using ps aux | grep ... the output depends on the terminal size. This seems seriously weird for me.
Isn't a pipe supposed to make command's output behave in a predictable way?
For example ls does all fancy formatting magic when run on its own, but when run like ls | less it always returns the same output styling.
But unlike ls, the output from ps aux | less cuts the lines to terminal width on FreeBSD (on bash at least). From my brief experimenting, the same command always outputs full length lines in Linux when used with pipes.
Why is this happening and how can I fix it?
Is this just a really weird FreeBSD default? From my understanding this "feature" would make it almost impossible to write reliable bash scripts on FreeBSD as the output of simple piped commands would not be reliable. Isn't this a problem?
Update:
Thanks to Bert, I've tried it with ps aux > somefile and the lines inside the file are cut exactly like how it was with grep and less!
Info:
FreeBSD 10.2, bash 4.3.42, same when connecting over SSH or when logged in locally via KVM.
Comment: I'm on `bash` and `ls` and/or `ps aux` produce same output with or without `|`, why don't you post these examples to question and also post output from `alias` command as well and version of your FreeBSD, bash and whatever else is relevant...
Comment: I've added the relevant information. There is only difference if you have long lines (longer than your terminal's width) on ps aux for example. You can try by making your terminal narrower.
Comment: I also can't reproduce this issue. Can you add some example commands and the output you are getting?
Comment: It sounds that your system has a broken implementation of `ps` that incorrectly honors terminal width always. My system has `ps --version` saying `procps-ng version 3.3.10` and at least this version seems to have sane behavior (lines are cut when output goes directly to terminal, lines are not cut when output goes to anywhere else).
Answer: It's not the piping doing it. Part of your problem is your pager, less. By default it truncates at the same length as your terminal does. You can fix this by telling it not to do that:
ps aux | less -S
ps detects the window width and outputs to fit
The man page has one way to bypass this:

-w Use 132 columns to display information, instead of the default which is your window size. If the -w option is specified more than
  once, ps will use as many columns as necessary without regard for your
  window size. Note that this option has no effect if the "command"
  column is not the last column displayed.

Another solution would be to pipe the output to a file
ps aux > somefile
Comment: @zsero is saying that the trick of redirecting stdout does not work on his setup, so you're not really addressing the question here. His setup is a bit bizarre though, could do with some more examples to narrow down the circumstance in which this can happen.
Comment: 1. It doesn't depend on less, it is the same with grep.
2. It is actually the same when piping to a file. `ps aux > somefile` has the lines cut exactly at terminal length!
Comment: Actually the reverse: `less` defaults to wrapping long lines and `-S` makes it truncate. But 'procps' `ps` on (all?) Linux does widen when output is redirected (including pipe) while FreeBSD `ps` needs `w` -- or envvar COLUMNS.


Am i underperforming or there is a such thing as overpracticing?

Question: there is a lot of debate about how much practice is enoug,is too much etc.
its been about a month since i started deliberate practicing, focusing on rhythm; counting out loud, while trying to change chords, thinking about which notes i am playing and where i plan to go with it, my routine includes
Transcribing
Ear training
Rhythm
Chords
General technique
Speacial technique
Song learning
Note reading
But while doing these exercises im thinking about what im doing, counting rythm, thinking about which notes im playing and where i want them to lead to and it takes too much mental energy to focus that hard im supposed to be doing about two and a half hours of practicing ,about half of it requires focusing and even with this much i feel overwhelmed i feel like i should do even more but its just too hard for me to focus that much even right now i sometimes get on autopilot mode, so am i underperforming or is there such a thing as overpractice?
The reason of the question is basicly should i push myself even further or not
Comment: A month is just the very beginning. After six months to a year, you should be really noticing a difference.
Comment: What instrument? Guitar most likely. What does your teacher think? How long have you been playing? What long term aims?
Comment: @Tim I'm playing guitar, i cant afford a teacher atm, but i have some friends who are better then me, but i havent asked them about it i should've, i've been playing for two years but most of it is just noodling. My goals are to improve my ryhthm, play cleaner and to be able to actively improvise in a jazz setting. Sorry for not putting these details in the question. Todd Wilcox: Do you mean my endurance could get better, because my question isnt about progress, i can already see some progress in my playing. Just asking if adding more work would result in more/faster progress.
Comment: @TheD, I think an important question is whether or not you enjoy it. Which tasks in this practice list that you enjoy doing? Your mental fatigue might a result of practicing each task for too short a time. Spending more time on one task could allow you to automate some aspects of that practice routine, which would reduce the mental drain.
Answer: I think your basic problem is that you are a complete beginner but you are trying to learn "everything all at once."
Practicing without thinking about what you are doing doesn't have much value, but if you try the equivalent of learning "everything you would be taught during several years at high school" in a month, it's not surprising you end up mentally exhausted.
There is nothing obviously "wrong" with your list of topics to study, but just take it steadily, and accept that it will take you a few years (not a few weeks) to achieve all your ambitions.
You might find that three 10-minute practice sessions with a really high "mental work rate" is better than one 30-minute session - and a lot better than one 2 1/2 hour session that leaves you mentally exhausted.
As you progress you will be able to practice productively for longer at a time. If you want to win marathons, you don't start your training by trying to run complete marathons - you work up to that goal in stages!
Answer: I remember an interview where Itzhak Perlman was asked how much he practiced? He said that for most of his life he practiced three hours a day. The interviewer could not get it over herself to believe this.
If I remember she asked astonished, but how was this possible or something to that effect, to which he just answered that he always made sure that when he practiced he was in the correct state of mind.
His practice was well structured and highly disciplined. I'm sure when he practiced there were no distractions, he focused completely on his violin and he was methodical in his approach.
If there was something he struggled with I'm sure he practiced it slowly and in time until he eventually got it.
When it comes to practice it has always been my view that it is important to have QUALITY over QUANTITY.
Answer: First of all: I applaud your ambition and enthusiasm - the most important thing is to always keep that going as much as possible.
Anyhow - I think you have good answers here already, but this is too long for a comment, so:
im supposed to be doing about two and a half hours of practicing
Who said that's what you're supposed to be doing? That's a long practice session focusing just on the technical aspects of playing for a lot of musicians, no less a relative beginner.

is there such a thing as overpractice?

Yes, there is such a thing. Pushing yourself too far won't help you, and it might hold you back: You're liable to get sick of it/burnt out, and slide all the way back. You may not see it yet, but it happens.
Burn-out is not uncommon, and it can sometimes be abrupt: One day you sit down to practice and you're just not in the mood - you can't get it going - you start to feel depressed and discouraged - you'd rather watch TV or go out with some friends - you feel as if life is passing you by and you're wasting your time with music - never making enough progress... Finally you put down the guitar and don't touch it again for another 10 or 20 years, or maybe never.
Keep in mind: The rests are a very important part of the music.
If you really believe you need such a long practice session, at least break up your routine by playing along with records and experimenting - things that you can enjoy. Practicing is usually not fun - it's work. But you can mix in some fun to make it easier. Still, it's highly questionable if you need to hold such long practice sessions, as the other answers have stated.

Am i underperforming

There is no objective way for any of us to know that. Who/what is going to determine if you are underperforming? Underperforming compared to who? Compared to what? There is no set timetable for anybody's progress. It depends on your goals, your talent, your available time...
If you were Franz Liszt, you might be "underperforming" if it took you more than an hour to play through a whole fake book on the piano. If you were me, it would be great to do it in a month's time (on guitar or bass).
I see in the comments that you can't get a teacher right now. But you can get books that have methods and lesson plans that give you focused exercises, milestones and goals to achieve over time, and a reasonably paced plan for moving forward in doable steps. I cannot offhand recommend the right book for you (I've bought any number of books that I never use, and two or three I use all the time...) but do some research: The reviews on Amazon from real people about instruction books is a good resource. Also try googling for information and material.

Above all: If you are indeed as serious as you sound, do whatever it takes to get yourself a decent teacher (research that too), and meanwhile do talk to your musician friends and try to get help and feedback from them - maybe play with them sometimes. It's very difficult to feel good about what you're doing or know if you're really making progress, without feedback and help from other musicians.
Answer: Long-term improvements come as sleep gradually replaces consciously memorized temporary skills with hardwired ones.  Only that way do they become accessible without requiring extra focus (which is available only within limits).
The learning process itself is something that gets better with training (so you'll manage longer productive sessions eventually).  So the best thing you can do when exhausted is sleep.  Note that there is no requirement to sleep only once per day.  Some of my most productive phases in life involved alternating phases of about 10 hours of work and 6 hours of sleep without much in terms of synchronization to the sun.  Obviously, for practising an acoustic instrument in typical modern living situations that is not entirely feasible.
Now whether there is actually a point to maximizing your skill acquisition by letting it take over your life is nothing anybody except yourself can answer.
Comment: doubt i can start napping, since i have trouble sleeping at nights but thanks for your insight
Comment: @TheD - maybe try sleep during the day? I do that a lot - up late, sleep during the day - but my work schedule accommodates that.


CNN vs RNN for time series classification

Question: I am new to neural networks and after some research i read about CNN and RNN neural networks. The data that i am having is multiple different time series of numbers.
So for example instead of input 1 being for example a single image to be classified it is a number of time series:
input 1: time series type A, time series type B, time series type C
input 2: time series type A, time series type B, time series type C
From these time series i would like to have two outputs. If a single time series looks abnormal or normal based on already classified training data for each time series type, and finally based on all time series a single result for the input, if it is normal or abnormal. (If any of the time series of the input are abnormal then the result is abnormal)
My questions are:
1) Should i use a CNN or a RNN for this problem? I read that RNNs are good in sequences, for example languages, but what about time series data. On the other hand i found other articles using CNN for time series classification.
2) How should i approach this problem? Should i use all time series as inputs on my neural network of choice? or should i use multiple neural networks for each time series type? Note here that each time series describes a different thing, but at the end i would like to have a single result based on all time series, for each input.
Thanks.
Answer: As you said, usually RNN, because their memory mechanism, are good in sequences, but other approaches are also possible. However it depends on what your data represent and it's not too clear to me, how different time series types are related among each other.
You could have different approach to try, but I repeat that it's not clear to me what your data represent and how they are related.
Here just few of them.
1) Train a RNN for each sequence type to learn to classify them and then use a consensus on the whole input
2) As 1.), but training using a unique RNN for all sequence types
3.) Concatenate your sequences types for each input so build a unique model RNN based to produce an embedding on which you could apply two classifiers (multi-tasking fashion). The first classify each sentence, while the second classify the whole input
Answer: In your case, you can try RNN or CNN.
For the RNN, you can let the model see the previous few numbers to predict the next one(or a few ones), and if the prediction is within one standard deviation there is no problem. Here is an example: RNN based Time-series Anomaly detector. If the numbers are categorical you can train a language model and score the sequence by the perplexities for each number. If the perplexity is larger than a threshold you can make it as abnormal. Or you can try a bidirectional LSTM and get the final state and concatenate them as the feature and add a logistic regression on top of it.
And you can also use CNN with a particular large kernel size and max-pooling as a direct classification problem. But be cautious since CNNs are position invariant.


How to add custom fields to a page

Question: Am newbie here. I just have a problem with fields adding them to a page.
I want fields specificly textboxes and a button to be in a page. This page will be used by my authenticated users. These textboxes will be filled in by the said users then have the system save the info to the DB after click of the button.
How do I do this? I created a content type of this but i can't seem to add them in the page. No article i can find here either that answers my problem. Please help. Am new here and am not a coder.
Thanks y'all.
Comment: The easiest way, without any programming experience, would be to install the webform module.  Buried deep in the webform options is the ability to create the form as a block, which will allow you to place it anywhere.
Answer: Drupal allows content to go onto your site, such as a Page or Book through a content type. If you want to show a Page or Book and embed a field or form on that page that is backed by a database -- typically you have to use another module for that which allows you to embed Forms onto existing Page (Node) content.
To do this usually you can use 1 of the following modules:
Webform

Webform is the module for making forms and surveys in Drupal. After a
  submission, users may be sent an e-mail "receipt" as well as sending a
  notification to administrators. Results can be exported into Excel or
  other spreadsheet applications. Webform also provides some basic
  statistical review and has an extensive API for expanding its
  features.
Some good examples could be contests, personalized contact forms, or
  petitions. Each of these could have a customized form for end-users to
  fill out. If you need to build a lot of customized, one-off forms,
  Webform is a more suitable solution than creating content types and
  using CCK or Field module.

or
EntityForms

The Entityform module enables you to create front-end forms (fieldable
  entities), which contain fields that you define! These forms use the
  standard Drupal fields. This means that out of the box, you can use
  any standard Drupal node field!

These modules allow you to embed any form you define through their admin interface into existing page content.
A key difference is in these forms is that Webforms stores its own data in a custom backend difficult to make into drupal (page) content on your website. While EntityForm since it uses Drupal Fields -- it's submitted content may easily be turned into Drupal site content (but need not be).
Comment: Hi @tenken, thanks. Will try to use both. I really hope one of them works for me. :D

How to add custom fields to a page


Erro mkConfigObj Knex

Question: Estou criando uma migration a partir do Knex, mas quando rodo o comando
npx knex migrate:latest --knexfile knexfile.ts migrate:latest

Recebo o seguinte erro:

No configuration file found and no commandline connection parameters passed at mkConfigObj

Já acessei o arquivo que o erro aponta, são algumas configurações do CLI.
Meu knexfile.ts
import path from 'path';

module.exports = {
    client: 'sqlite3',
    connection: {
        filename: path.resolve(__dirname, 'src', 'database', 'database.sqlite')
    },

    migrations:{
        directory: path.resolve(__dirname, 'src', 'database', 'migrations')
    }
};

Comment: O arquivo knexfile.ts tem que estar na raiz do projeto. Provável que o seu não esteja.
Comment: Eu já tive esse problema, e era de fato o caminho errado do knexfile.ts.
Answer: Oie, tive o mesmo erro. era pq estava no diretório errado. Entre no diretório do back-end, e executa o comando dnv que da certo.

npm install knex
npm install sqlite3 (se for esse q vc estiver usando)
npx knex migrate:latest --knexfile knexfile.ts migrate:latest

Funcionou comigo.

Erro mkConfigObj Knex


Visual Studio 2013 Setup Failed from VsGraphics Helper Dependencies (Not a cryptographic message)

Question: Download the Visual Studio 2013 Ultimate package from Microsoft Volume Licensing site; extracted the ISO to a local folder and ran the EXE.
All goes well for a while, until it fails and says "Setup Failed!"
Then it displays the error message...

Microsoft Visual Studio 2013 VsGraphics Helper
Not a cryptographic message or the cryptographic message is not formatted correctly.

See screenshot @ https://i.stack.imgur.com/stdYB.png
Comment: I've tried this on three different Windows 7 machines; two physical and one virtual.. all failed with the same error type.  So I'm downloading Visual Studio 2012 Ultimate, and Windows 8.1 Enterprise now.. will see if it 2012 works any better; and will install 8.1 on VMWare and ten try VS2013 again.
Comment: Looks like **Visual Studio 2012 Ultimate** installed fine on _Windows 7_, unlike **VS2013 Ultimate**
Answer: The fix for my issue was to browse the image and locate the installer package for the vsgraphics_helperbits.msi.
Location relative to ISO:
\Install\packages\vsgraphics_helper\amd64\vsgraphics_helperbits.msi
Answer: Just on internet on your pc and go to the below path then rename the amd64 to amd64888s
packages\vsgraphics_helper\amd64
Now run the setup and after getting package error just click on the download from internet option and continue the setup.
Have a happy coding
Answer: I encountered the same problem with the Visual Studio 2013 Ultimate With Update 5 ISO after extracting it even if the SHA-1 was correct.
Solution if your machine has access to internet : Simply delete the corrupted packages folders in packages\. The installer will prompt you to download them.
You can find the packages in error in the log given by the installer when the setup is complete (fail or success).
On my Windows 7, I had to delete these packages to avoid errors and warnings :

netfx_451mtpack
netfx_451mtpackcor
PerfTools_CORE
PortableLibrary
professionalcore
sptoolsDependencie
TFSObjectModel
TFSStoryboarding
VCDesigntime
vcRedistD11
vc_libraryDesktop
vsgraphics_helper

In bold the critical ones.
Answer: I just had this issue.  Someone at another site suggested that it the ISO image file of the install was corrupt.  We redownloaded it, and it installed correctly the second time.
Answer: Just make sure you have updated your windows. (Restart windows after update)
If you have the ISO then mount it to virtual drive and then run the installer. (Don't extract and run)
Hope above instructions will help.
Note: Follow same process for VS 2015 installation.


Parent-child node relationship without using taxonomy?

Question: I'd like to be able to offer sub-site maintainer's the ability to create their own sections of content. I can use a hierarchical taxonomy tree to force multiple levels of content to be classified at different depths of the site. However, I'd rather not be on the hook for revising custom nested term lists for each maintainer.
Is there an easy way to allow publishers to create parent node <-> child node relationships without relying on taxonomy revisions?
I'm using Drupal 7 and Node Hierarchy is unfortunately not yet out of development for D7.
Answer: You can use Entity Reference module.
You create two content types: Parent and Child.
in Child content type, add an mandatory "Entity Reference" field that reference to a Parent node.
Answer: You can try using book module which comes with drupal core. you can checkout the documentation provided here.

A book is a set of pages tied together in a hierarchical sequence,
  perhaps with chapters, sections, subsections, and so on. You can use
  books for manuals, site resource guides, Frequently Asked Questions
  (FAQs), or whatever you'd like.
Answer: I do something like this of a simple project management system.
I have one content type - Project/Task which has a node reference that I call Parent Task that is NOT required.
I have a simple module that adds in a task level if this field is filled out and then indent this.  Let me know if you want more details.


How to convert 18 bits two-complements into float number using java

Question: The data is uploaded by 18-bits ADC. One data is split into three bytes and the last 6 bits is useless. The reference voltage is 1 volt, that means 0x1FFFF represents 1 and 0x3FFFF represents -1. How to convert 18-bits twos-complement into float using java. I have written one and it works, but I think it is not efficient enough. My java is terrible.
    float data;
    int value = ((byte0 & 0xff) << 10) | ((byte1 & 0xff) << 2) | ((byte2 & 0xff) >> 6); // combine 3 bytes into int
    int tmp = value & 0x2000;   // judge positive or negative

    if (tmp != 0) {
        value = value - 262144 /* 2^18 */;
        data = ((float)value) * 2 / 262143 /* 2^18-1 */;
    } else {
        data = ((float)value) * 2 / 262143;
    }

Comment: Except I'd declare 262144 and 262143 names constants initialized from hex (or octal) literals I think your code is fine.
Comment: how often is this code running? did you evaluate which percent of processor time it consumes? It well may turn out to be a negligible fraction.
Comment: are you sure the code works? looks like it returns positive float for negative input.
Comment: Sorry, I posted the wrong code. When the input is negative, it should minus 2^18 first. I have corrected the code.
Comment: 0x2000 is not the 18th bit, it should be 0x20000
Answer: You could try
double data = (value << 14) / (double) (0x1FFFF << 14);

This will use a shifted 32-bit 2s complement value.
NOTE: If it was 2s complement, 0x3ffff should be the smallest negative number, and 0x20000 is the largest negative number.
Answer: Put the sign bit of the ADC in the same place as the sign bit of a 32-bit integer and you can simplify by using the native sign.
public static final float ADC_RANGE = 1.0f; // From -1V to +1V
public static final int   ADC_BITS  = 18;
public static final int   ADC_RANGE = 1 << (ADC_BITS - 1);
public static final int   ADC_MASK  = (ADC_RANGE - 1) << (32 - ADC_BITS);

    int bits = ((byte0 & 0xFF) << 24) | ((byte1 & 0xFF) << 16) | ((byte2 & 0xC0) << 8); // Combine 3 bytes into int, left-aligned
    float value = bits / (float)ADC_MASK * ADC_RANGE;

[edit] use constants for 'magic numbers'
Comment: I tested the code. It works but the result needs to divide (2^18-1). A problem is that if I want to use just one divisor (e.g. value = bits / divisor), the divisor is too big to represent by a constant. The division operation must be used twice or more.
Comment: You said you had 18 bits of which one is the sign bit, so to get a range of -1..+1 you divide by 2^17-1. `ADC_MASK` is 2^17-1, just left-aligned in an int.  What do you mean with too big to represent by a constant?
Comment: Sorry, I understood wrong. I tried to run your code but it can not compile successfully because there is a float ADC_RANGE and an int ADC_RANGE.


Good Reason to use java.util.Date in an API

Question: Are there any specific reasons to use a Date class in an API (for example, in an employee birth date field) rather that a long or Long.
There is some discussion of this in:
java-date-vs-calendar, but I would like to know specifically if there is any justification for using Dates, when a long (or Long) seems so much simpler.
Of course I would use TimeZone and SimpleDateFormatter to parse and display dates in a GUI, and maybe Calendar to perform manipulations, but I am concerned only about the storage and representation of date in the data model/API in this question.
Update: An example of one reason why I would not choose Date is that it is mutable. So if I expose a Date in my API, callers can call setTime(long) and this seems to be a violation of basic encapsulation. To me this seems to outweigh the benefit of the added clarity that using a Date provides, since I could just call the long property timeInMillisecondsSinceEpoch and communicate the same information to callers.
Comment: FYI, the terribly troublesome old date-time classes such as [`java.util.Date`](https://docs.oracle.com/javase/10/docs/api/java/util/Date.html), [`java.util.Calendar`](https://docs.oracle.com/javase/10/docs/api/java/util/Calendar.html), and `java.text.SimpleDateFormat` are now [legacy](https://en.wikipedia.org/wiki/Legacy_system), supplanted by the [*java.time*](https://docs.oracle.com/javase/10/docs/api/java/time/package-summary.html) classes built into Java 8 and later. See [*Tutorial* by Oracle](https://docs.oracle.com/javase/tutorial/datetime/TOC.html).
Answer: If you use an integer to represent a Date in your API you will be adding an extra, unnecessary layer of complexity that will need extra documentation and make your API harder to use.
By using an integer you have to let the client know what the base date is, what you're measuring (e.g. seconds, milliseconds, minutes etc?) and force the client to do the conversion. Keeping a Date object in your API makes it simpler and friendlier IMO. And unless, for whatever reason, there are very serious performance implications I would suggest keeping the Date in your API, even if you need to do more coding internally. That's one of the things that makes a good API a good API... Not making your client jump through hoops.
Answer: Personally, as bad as the date and time API in Java is, I tend to use Date. It just has more semantic value. Additionally, you don't have to guess whether it's seconds or milliseconds.
Answer: A date is not a number, it is a point in time. The fact that you can represent that with a number is an implementation detail that should be hidden.
Answer: The Date class is part of the API and as such a valid option if it fits your purpose. There are many deprecated methods in it that were replaced by the Calendar class, so make sure you avoid using those methods.
The answer will depend on what is what you need to accomplish. If you just need to sort by the date, a long will be more than enough. A Date value would add some readability to it, but not more functionality. Using Date will not be detrimental either, so the readability factor should be considered.
If the field will be private, you can actually store it as a long and have a getter and a setter that use Date :
private long mDOB;

public Date getDOB () { return new Date(mDOB);}
public void setDOB (Date dob) { mDOB = dob.getTime(); }

Comment: how would you change the code now that Date constructor (and more) are deprecated?
Comment: @DrorCohen You are incorrect. That [java.util.Date constructor](http://docs.oracle.com/javase/8/docs/api/java/util/Date.html#Date-long-) is not deprecated as of Java 8. The code shown in this answer is correct.
Answer: Never use a long
A long or Long exposes internal implementation details that could change. Some utilities and libraries track date-time by seconds, microseconds, or nanoseconds rather than the milliseconds you might assume.
The count is from an epoch reference date-time. There are dozens of such epochs in use by various software systems. So which epoch can be ambiguous.
Working with date-time values as a number from epoch is inherently confusing as they are not human readable.  So debugging and testing are complicated.
Why not track text as a series of octets or even bits? Because we want libraries to handle the nitty-gritty complexities and chores (UTF-8, MacRoman, searching, replacing, trimming, etc.) for us. Likewise, date-time values should be handled as date-time data types.
If given a count of seconds or milliseconds since epoch of first moment of 1970 in UTC, 1970-01-01T00:00Z, parse into Instant using convenient factory methods found on that class.
Never use Date or Calendar
That said, the java.util.Date and .Calendar classes are terrible. Avoid them whenever possible.
Always use java.time
With Java 8 and later, we have the modern java.time package. These supplanted the terrible old legacy classes as of the adoption of JSR 310.
For Java 6 & 7, see the bullets below for ThreeTen-Backport project, and ThreeTen-ABP for earlier Android.
Always use ISO 8601 strings
When storing or exchanging date-time values as text, use Strings in the standard ISO 8601 format. These are unambiguous, easy to read by humans across cultures, and easy to parse by machine.
Immutable objects

I would not choose Date is that it is mutable.

Using immutable objects makes sense for date-time values. The java.time classes use immutable objects as part of the strategy to be inherently thread-safe.
Presentation

to parse and display dates in a GUI

Keep separate the tracking of moments, which is usually best done using Instant, from generating text for presentation to users. For presentation, adjust into a time zone (ZoneId) to get a ZonedDateTime, from which you can generate text using a DateTimeFormatter.

I am concerned only about the storage and representation of date in the data model/API

For storage, adjust to UTC by working with Instant class. Generate ISO 8601 strings by default using toString method. For representation in your data model, use Instant for a UTC value unless you have a specific need per your business rules to consider a specific time zone, in which case use ZonedDateTime.

About java.time
The java.time framework is built into Java 8 and later. These classes supplant the troublesome old legacy date-time classes such as java.util.Date, Calendar, & SimpleDateFormat.
The Joda-Time project, now in maintenance mode, advises migration to the java.time classes.
To learn more, see the Oracle Tutorial. And search Stack Overflow for many examples and explanations. Specification is JSR 310.
You may exchange java.time objects directly with your database. Use a JDBC driver compliant with JDBC 4.2 or later. No need for strings, no need for java.sql.* classes.
Where to obtain the java.time classes?

Java SE 8, Java SE 9, Java SE 10, Java SE 11, and later  - Part of the standard Java API with a bundled implementation.

Java 9 adds some minor features and fixes.

Java SE 6 and Java SE 7

Most of the java.time functionality is back-ported to Java 6 & 7 in ThreeTen-Backport.

Android

Later versions of Android bundle implementations of the java.time classes.
For earlier Android (<26), the ThreeTenABP project adapts ThreeTen-Backport (mentioned above). See How to use ThreeTenABP….

The ThreeTen-Extra project extends java.time with additional classes. This project is a proving ground for possible future additions to java.time. You may find some useful classes here such as Interval, YearWeek, YearQuarter, and more.


Teams calendar requests causes Exchange Server 2016 to log unhandled exception (maxQueryStringLength)

Question: Teams calendar requests causes Exchange Server 2016 to log unhandled exception (maxQueryStringLength)
Our on-premises Exchange Server 2016 is logging unhandled exceptions – it appears to be Teams querying calendar data via REST API.
In the event log: (example.com is our on-premises Exchange Server)
<code>Exception information:
    Exception type: HttpException
    Exception message: The length of the query string for this request exceeds the configured maxQueryStringLength value.
   at System.Web.HttpRequest.ValidateInputIfRequiredByConfig()
   at System.Web.HttpApplication.PipelineStepManager.ValidateHelper(HttpContext context)

Request information:
    Request URL: https://example.com/api/v2.0/me/calendarView?$top=0&$select=attendees,body,categories,end,hasAttachments,iCalUId,id,isAllDay,isCancelled,isOrganizer,isReminderOn,location,locations,onlineMeetingUrl,organizer,originalEndTimeZone,originalStartTimeZone,reminderMinutesBeforeStart,responseRequested,responseStatus,sensitivity,seriesMasterId,showAs,start,subject,type&startDateTime=2020-03-25T20:46:37Z&endDateTime=2020-03-25T21:46:37Z&$expand=singleValueExtendedProperties($filter=PropertyId eq 'String {00020329-0000-0000-C000-000000000046} Name SkypeTeamsMeetingUrl' or PropertyId eq 'String {00020329-0000-0000-C000-000000000046} Name SkypeTeamsProperties' or PropertyId eq 'String {00020329-0000-0000-C000-000000000046} Name SchedulingServiceUpdateUrl' or PropertyId eq 'Integer {00062002-0000-0000-C000-000000000046} Id 0x8217' or PropertyId eq 'String {00020329-0000-0000-C000-000000000046} Name OnlineMeetingConferenceId' or PropertyId eq 'String {00020329-0000-0000-C000-000000000046} Name OnlineMeetingTollNumber' or PropertyId eq 'Binary {6ed8da90-450b-101b-98da-00aa003f1305} Id 0x0023' or PropertyId eq 'Boolean {00020329-0000-0000-C000-000000000046} Name DoNotForward' or PropertyId eq 'String {00020329-0000-0000-C000-000000000046} Name ClientOptimisticEventId' or PropertyId eq 'String {00020329-0000-0000-C000-000000000046} Name OnlineMeetingConfLink' or PropertyId eq 'String {00020329-0000-0000-C000-000000000046} Name TeamsVtcConferenceId' or PropertyId eq 'String {00020329-0000-0000-C000-000000000046} Name TeamsVtcTenantId' or PropertyId eq 'String {6ed8da90-450b-101b-98da-00aa003f1305} Name OnlineMeetingConferenceId' or PropertyId eq 'String {6ed8da90-450b-101b-98da-00aa003f1305} Name OnlineMeetingTollNumber'),multiValueExtendedProperties($filter=PropertyId eq 'StringArray {00020329-0000-0000-C000-000000000046} Name OnlineMeetingTollFreeNumbers' or PropertyId eq 'StringArray {6ed8da90-450b-101b-98da-00aa003f1305} Name OnlineMeetingTollFreeNumbers')
</code>
Comment: Did you try to update the maxQueryStringLength in your config file?
Comment: Thank you, we made the change today and will monitor.
Comment: Thank you, it worked like a charm.
Comment: I accepted M. Warren's answer.  It had the most details.
Answer: Edit:  "C:\Program Files\Microsoft\Exchange Server\V15\FrontEnd\HttpProxy\rest\web.config"
Add

maxQueryStringLength="10240"

to

< httpRuntime  />

e.g.
< httpRuntime maxRequestLength="2097151" maxUrlLength="2048" maxQueryStringLength="10240" requestPathInvalidCharacters="<,>,*,%,\,?"
requestValidationMode="2.0" />
I might be out on the size by a mile (max string was ~1956bytes) but this was annoying me to no end.
Comment: Thank you, we made the change today and will monitor.
Comment: Thanks, I missed seeing the 'checkmark' for accepting the answer, I have accepted your answer now.
Answer: Update the maxQueryStringLength in web.config file.
Comment: M. Warren's answer is better because it specified detailed location and format.


Fatal error: Uncaught Error: Class - composer

Question: Em alguns posts(perguntas), não consegui encontrar uma solução para este erro e gostaria da ajuda de vocês expert no assunto.
É algo simples, só quero que mostre um simples echo "Listar Pagina" de acordo com o composer.json, para ter certeza de que esta tudo ok no trajeto, mas, nada resolve, não encontro o erro... :'(
index.php
require 'vendor/autoload.php';

use Core\ConfigController as Home;

$Url = new Home();
$Url->carregar();

ConfigController.php
<?php
namespace Core;
class ConfigController {
    public function carregar() {
        $listarPg = new \App\adm\Models\AdmsPaginas();
    }
}

AdmsPaginas.php
<?php
class AdmsPaginas {
    public function listarPaginas() {
        echo "Listar Paginas";
    }
}

autoload.php
{
    "name": "w/m",
    "description": "Projeto WM",
    "authors": [
        {
            "name": "WM",
            "email": "email@example.com"
        }
    ],
    "autoload": {
        "psr-4": {
            "Core\\": "core",
            "Sts\\": "app/sts",
            "Adm\\": "app/adm"
        }
    },
    "require": {}
}

autoload_psr4.php
<?php

// autoload_psr4.php @generated by Composer

$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);

return array(
    'Sts\\' => array($baseDir . '/app/sts'),
    'Core\\' => array($baseDir . '/core'),
    'Adm\\' => array($baseDir . '/app/adm'),
);

Pastas
Erro
Comment: Evite agradecer e cumprimentar nas publicações pois aqui no [pt.so] são considerados ruído de comunicação. Veja [Que tipo de comportamento é esperado dos usuários?](http://pt.stackoverflow.com/help/behavior), [Saudações e Agradecimentos](http://pt.meta.stackoverflow.com/q/846/137387) e [Como se portar ao perguntar/responder?](http://pt.meta.stackoverflow.com/q/38/137387).
Answer: Obrigado, já resolvi, só precisei colocar o caminho no index.php
index.php
<?php

require './core/Config.php';
require './vendor/autoload.php';
require './app/adm/Models/AdmsPaginas.php';

use Core\ConfigController as Home;

$Url = new Home();
$Url->carregar();


Select em multiplas colunas com ponto no nome não retorna resultado

Question: Cada coluna é composta de nomes, Fulano, Ciclano, Beltrano etc.. Quero selecionar todos os nomes que sejam diferentes. Se existir Joaquim em duas colunas tem que me retornar um só. Mas o problema não está ai, está no nome das colunas que contém ponto col.A col.B col.C Não sei se isso é permitido, não li nada contra mas o caso é que não funfa nem sem [ ] nem com [ ].
Não obstante , o motivo da pergunta é saber se há alguma especificação contra ou algum jeito de fazer rodar com ponto nos nomes das colunas
<code>   $result = mysql_query("SELECT DISTINCT [col.A] FROM stabela UNION SELECT DISTINCT [col.B] FROM stabela UNION SELECT DISTINCT [col.C] FROM stabela");

    while($row = mysql_fetch_array($result)){
      $nome=$row['col.A'];
    }
</code>

Warning:  mysql_fetch_array(): supplied argument is not a valid MySQL result resource in ....... on line 58
A linha 58 é  (while($row = mysql_fetch_array($result)))
Comment: Não seria `\`Col.A\``,  `\`Col.B\``,  `\`Col.C\``, ao invés de entre `[ ]`?
Comment: ja tentou apelido? tipo [col.A] as colunaA, [col.B] as colunab..?
Comment: Inkeliz é isso mesmo, funcionou!! O negócio é colocar entre aspas invertidas (a crase do nosso teclado).
Answer: Já tentou tirar os colchetes?
<code>SELECT DISTINCT
    col.A
FROM stabela

UNION
SELECT DISTINCT
    col.B
FROM stabela

UNION

SELECT DISTINCT
    col.C
FROM stabela
</code>
Comment: Essa foi a primeira tentativa!
Comment: Voce precisa saber qual resultado veio de cada coluna?
Comment: poderia tentar:

SELECT DISTINCT
    col,
    'A' as coluna
FROM stabela

UNION
SELECT DISTINCT
   col,
   'B' as coluna
FROM stabela

UNION

SELECT DISTINCT
    col,
    'C' as coluna
FROM stabela
Comment: Entendo. Acredito que o problema seja o nome da coluna utilizando "."
Tenta substituir o ponto por _

veja esse artigo acho que vai ajuda-lo
http://www.devmedia.com.br/padronizacao-de-nomenclatura-revista-sql-magazine-100/24710
Answer: Vou postar aqui a solução encontrada que achei no Guia de Estudo para Certificação MySQL e também na documentação recomendada pelo nosso amigo Anderson Carlos Woss Schema Object Names
Coloque os nomes das colunas na query entre aspas simples invertidas.
<code>$query = mysql_query("SELECT DISTINCT `col.A` FROM stabela UNION SELECT DISTINCT `col.B` FROM stabela UNION SELECT DISTINCT `col.C` FROM stabela");
</code>
Essa aspas invertidas nada mais são que o acento crase do seu teclado. Shift + tecla acento e tecla espaço. Fiz o teste no DB e rodou redondinho :)
Comment: A comunidade ser em português não exclui a possibilidade de você utilizar referências em inglês. Principalmente quando é a documentação oficial da ferramenta que está utilizando. Quanto ao ponto, verás, se ler: *Permitted characters in quoted identifiers include the full Unicode Basic Multilingual Plane (BMP), except U+0000*. *Quoted identifiers* são identificadores entre crases, como utilizou na sua resposta.
Comment: *If an identifier **contains special characters** or is a reserved word, you must quote it whenever you refer to it.*, apenas dei a dica para você embasar sua resposta em uma referência confiável. Isso aumentaria muito a confiabilidade da mesma. Você coloca a referência se quiser,
Comment: Tem tudo explicado aqui na [documentação](https://dev.mysql.com/doc/refman/5.7/en/identifiers.html), caso queira adicionar à resposta.
Comment: Pelo que entendi, faz referência a colocar aspas para identificadores que sejam palavras reservadas  mysql> SELECT * FROM `select` WHERE `select`.id > 100; que não é o caso de nomes de colunas com ponto. Nomes de colunas com ponto não são palavras reservadas ou nome de funções.
Comment: Vi vários sites falando de caracteres especias, mas nenhum deles se referiu ao ponto.
Comment: Então basta ler o tópico anterior "Permitted characters in unquoted identifiers" e verás que somente é permitido `[0-9,a-z,A-Z$_]`, não incluindo o ponto.


Consider a set $A$ of $10$ integers, $A = \{a_1,a_2, \ldots ,a_{10}\}$. Prove that there is at least one subset of $A$ whose sum is divisible by $10$.

Question: Consider a set A of 10 integers, $A= \{a_1,a_2, \ldots ,a_{10}\}$. Prove that there is at least one subset of A whose sum is divisible by 10. Use the pigeon-hole principle.
Hint: Consider the 10 sums $s_1 = a_1, s_2 = a_1 + a_2, \ldots ,s_{10} = a_1 + a_2 + \ldots+a_{10}$. If one of these ten sums is divisible by $10$, we are done. So assume that none of these ten sums is divisible by $10$.
I'm pretty sure this is the proof but im not exactly sure what's $b_l$ and $b_k$ stand for?
Let $A=\{a_1,a_2,...,a_{10}\}$
Define set of numbers $b_n=\sum\limits_{i=1}^n a_n$ i.e. the set $$\{a_1, (a_1+a_2),(a_1+a_2+a_3),\ldots ,(a_1+a_2+\ldots +a_{10})\}$$
If any element of the set is divisible by $10$, then we are done.
Hence proving case $1$.
Case 2: Assume that no element of this set is disible by $10$.
Then, by Pigeon hole priciple, there exists some $k<l$, such that, $b_l\equiv b_k$
then $b_l\equiv b_k (mod 10)$ with $l>k>0$
Hence, $\{b_k,b_{k+1}, \ldots,b_l\}$ is a subset of $A$ whose sum is divisble by $10$.
Thus proving Case $2$.
Comment: There are only 10 possible remainders, and you have 10 elements $b_i$.  If none are divisible by 10, you have only 9 potential remainders, so 2 must double up.  Hmm...
Comment: Nothing in the way the question is stated rules out the empty set, which is a subset of $A$ and has sum zero, which is divisible by 10. Presumably, one wants to ask for a nonempty subset of $A$.
Answer: This is a general proof for:
In a list of $N$ integers, there exists a non-empty subset of this list whose sum is divisible by $N$.
Statement $1$: If $a_1$ and $a_1+a_2+a_3$ have the same remainder when divided by $N$, $a_2+a_3$ must be divisible by $N$.
We define a set $A$ with $N$ elements (this is our list):
$$A = \{a_1,a_2,a_3...a_N\}$$
Then we define $B$ as a set where $B_n = \sum_{i=1}^{n}a_i$
$$B = \{a_1,a_1+a_2,a_1+a_2+a_3...B_N\}$$
When a number is divided by $N$, there are $N$ possible remainders $(0,1,2...N-1)$. We have $N$ elements in $B$. If every remainder is different, one of the remainders must be $0$, therefore, we have a subset whose sum is divisible by $N$. However, if not every remainder is different, then at least two numbers must share a remainder (pigeonhole principle). By statement $1$, we see that there is a subset whose sum is divisible by $N$. We can then have any $N$ and this proof will hold up.
Answer: $$b_n = \sum_{i=1}^n a_n.$$
$b_n$ is the sum of the first $n$ $a_i$'s.
In terms of modulo $10$, since none of them is $0 \mod 10$, by pigeonhole principle, we can find a pair of $b_i$, call them $b_l$ and $b_k$ such that
$$ b_l \equiv b_k \pmod{10}.$$
Hence $b_k - b_l \equiv 0 \pmod{10}$,
Hence $\sum_{n=k+1}^la_n$ is divisible by $10$.
Hence $\color{red}{\{a_{k+1}, \ldots, a_l\}}$ is one such subset.
I have highlighted a potential fix for a typo in your proof.