Why is music in music schools taught the way it is?

Question: Let me briefly tell you my personal story with music as a hobbyist.
TLDR : Got taught technique as a child, had no fun and quit, learned music by ear by myself later in life, having fun now and playing. I don't get why music is taught the way it is.
Retrospectively I wouldn't teach myself the way I was taught. I know plenty of people that had the same kind of disappointing learning experiences in music schools and have since stopped music.
I really feel music school are turning a vast majority of kids into music boxes at best, instead of making them musicians.
Why are music schools teaching the way they teach ?
Where should I send my kids for them to learn music ?
The longer version :
The farthest back I remember was making noise on my own with some electronic organ when I was 5 but I still remember I could spend hours pushing various buttons, switching instruments, pressing keys, and having fun doing so.
A few years later, my parents, having noticed my interest for music, started me off in music school; for the first two years it was just music theory. Then around 9, I started the piano. It was playing by the sheets, and learning scales. Basically learning the technique. I remember that I always had a rhythmic problem, always giving myself the liberty of stretching times to make it sound the way I preferred.
But every time I was corrected and made to play on rhythm. After a few years of that I became correct at playing mechanically, playing the right note on the right time. But the fun was going away at the same time. It was no longer about making the right sound or melody but more getting the right finger on the right key.
I also remember that when I learned to play a piece at most I had listen to the whole piece one or two times. I had a few teachers but it was always the same policy.
At 16, I stopped playing.
Ten years later, I tried to start playing again on my own to get stress out during a difficult life period. I began by following the same recipe I was taught. But quickly I realized it still was no fun.
So I decided to learn it my way. I wanted the music to come naturally.
The first month was just forcing myself to unlearn the mere fact that when I was pressing for example the "C key," my brain was saying "C" to itself. I played by making simple patterns of sound, and repeating them randomly at first. Then trying to search for patterns. I tried to make my own rules I would try to follow. And at all times I tried to listen to the sound the piano made while I played. In short I was exploring music on my own.
Over the course of a few months, playing half an hour a day, in a sense, I quickly picked harmony, rhythm, transposition, a sense of understanding and feeling. Sometimes I listen to a song and try to replay it. I try to get the theme, modify it a little on the fly to see where it takes me.
After two years of my own learning, everyday I'm still picking up new things; it is fun, varied and interesting.
I am still very far from being expert, and I've still a lot of problems if I try to play a music by the sheet, but I'm happy creating a simpler variation to make it less technical if I think I get the main idea right. I still don't get the fun of making things technical for the sake of being technical. Even though I can get pretty technical in my own compositions. But sometimes I feel I rediscover some technique tricks. And I've no doubts that in time missing techniques will come naturally to serve the need of expressing ideas.
Now everything I was taught over my years in music school make sense to me but it seems like it all was presented backwards.
I can see that all that was taught has some value, but if I had not restarted from scratch I still would not have gotten it.
I feel that presented the way it was, I had no chance at all of picking it up. I even feel that I would have picked it up if the teacher was not constantly depriving me of any liberty I granted myself.
Why do music schools teach the way they do?
Comment: The plural of "anecdote" is not "data." <-- What that cliche means is that your personal experience and your personal attitude towards music learning does not define all music programs or all people's interest in learning to play.
Comment: Your question / anecdote provide a myopic view of music education. It is statistically silly to suppose that all music is taught the particular way you have experienced it. Not all schools aim to "create a virtuoso" excepting possibly the elite conservatories. People that attend such schools are bred from birth to be musicians (a problem in its own way). If you studied really any textbooks for general musical education, you would see that the emphasis is on understanding and appreciating different world cultures and their music, not creating robots.
Comment: Lastly, teachers emphasize rhythm above other things because rhythms that are taught incorrectly and *notoriously* difficult to fix. A wrong not is very easy to fix. Now, was your education balanced? No. Should your teacher have done more to inspire your interest? Absolutely. But that said, this question is *by definition* a logical fallacy: https://en.wikipedia.org/wiki/Misleading_vividness
Comment: I would like to say that an understanding of music theory is critical for higher levels of musical accomplishment, and personally I progressed **much** quicker under my piano teacher in my first few years than in the past few without. If you want to pursue a more advanced level of musicality, a piano teacher is necessary for several reasons: A) They can impart knowledge quickly that would take large amounts of time to research, B) They hold you accountable, and C) They can get you connected in the field, competitions, guild auditions, etc. if you want to pursue music seriously.
Comment: Further, it is exceptionally rare for young children to possess the emotional complexity/maturity/expressiveness that can be channeled into the music. Even teenagers, biologically, struggle with this aspect of music (the pre-frontal cortex is not finished forming).  Most kids struggle just learning the basics, and the basics are technical. Emotional ranges tend to vary into the extreme - kids can show basic emotions, but complex gradations take time - lots of time - to develop. Teachers start with technique because if you have a solid foundation because learning on a per-piece basis is a waste
Comment: What part of the world, please?  What you said about music schools, in the context of children's musical education, makes me think of France.
Comment: @CarlWitthoft I agree I could be a statistical anomaly and I don't want to turn this into an opinion war. But when anecdotes tend to accumulate and cluster, there usually is some phenomenon behind it, which is what interests me. And statistically non musician parents who wants to teach music to their kids start by sending them to music schools. I would argue that "anecdotes" like mine are at least a significant "subset of data" (in terms of number of people affected), especially for kids whose parents could not help in music. I don't claim to hold the truth but feedback never hurts, right ? :)
Comment: I wouldn't agree at all that it's typical to send a child to a music school. At least where I grew up, the majority were either handed a guitar or had extra-curricular lessons from private teachers.
Comment: It might be more fun to pick up an instrument and start playing but it isn't very effective as you've discovered by still not being able to play from sheet music.  The bottom line is you have to learn to walk before you can run, your learning by ear may have not been possible if you hadn't previously done scales etc.
Answer: Look at it this way -- the entirety of your story could have been about being taught, becoming bored with, and eventually learning and exploring maths. But (western) society has these preconceived notions about math supposedly being technical and boring, and music supposedly being expressive and fun. In reality, the best teachers would teach both subjects in basically the same way.
And perhaps you were taught music and maths the same way by equally mediocre teachers using the same teaching methods. But maybe since you expected that from math class, and were given an option to quit music class, you kept on studying math and not music.
Of course I have no idea how you were actually taught math, but my point here is that quality of instruction and curriculum varies greatly, and moreso in the present day. Not every music teacher (or math teacher) teaches in a boring, stagnant way. All we can really say for sure is that the music curriculum that you experienced did not work well for your learning style and personality. There's nothing special about music, or even the education system, that says it has to have been done that way.
A modern day general music curriculum could include singing, movement, playing of instruments, improvisation, learning notation, and composition -- all before the end of elementary school. A school that focuses solely on music should be doing the same things, but at an accelerated rate.
From your story, it sounds like you went into a program that was designed for young musicians who already possessed many of these skills, and had an interest in learning and playing classical music. And so the curriculum focused exclusively on theory and notation, and execution of technique. There's logic to this -- it's how you create virtuosos -- but it's not for everyone. A more creative and empathetic teacher might have been able to notice your desire to improvise and play by ear, and nurtured those skills while still helping you build and understand the need for the skills you were having trouble with. (If you have bad rhythm, you're not going to be very successful playing with other people, learning notation is just as important for music as learning to read and write your native language, etc.)
Comment: @darkblue I think that many universities would disagree with you about piano exclusively being taught one-on-one. Music schools *do* select students by more than their skill - their ability to show community involvement, for example, is important. For college students, another factor is marketability - where they might be going and whether or not the school will really help them get there. Composition students are chosen on the kind of music they're *already* making. I know professors who have taken students that can't read or write but have strong potential ("talent" is a horrible word).
Comment: All the great writers - all successful writers - also spent a long time learning syntax and grammar. Think of it as theory of writing. I remember being bored by this in school, but it does make a difference. If you haven't learned how to write clearly and concisely you will have problems in life. There are a lot of people around writing badly. They have trouble being taken seriously; no matter how insightful their ideas are, if they confuse "its" and "it's" they are taken for idiots. If text is not written properly, it may be misunderstood.
Comment: I went where I where because it was the only music school of our town. My parents were not musicians, so they had no clue music schools end-goal was to create virtuosos, and I'd bet that at least 90% of parents had no clue either, they just send their kids there to learn music.  Math is usually taught in group, piano is taught one on one, I think that my parents thought the teacher would adapt to the kid. I think that music schools should do more than just  selecting kids based on the skill they show and putting them in the box where they would best express their shown talent.
Comment: By the way, I turned out to be excellent in math (to the point of it now being part of my job), but never really got music until recently. The main difference in the way I was taught is that piano was one on one.
Comment: "But (western) society has these preconceived notions about math supposedly being technical and boring, and music supposedly being expressive and fun." This is why, if I were a music teacher, I would teach the theory (harmonic series and 7-limit JI plus some exposure to the 11th and 13th harmonics) BEFORE getting into scales and chords so that my students know why scales and chords work the way they do. I can also see this making ear training easier since they would have a much clearer idea of what to listen for.
Answer: I understand what you are saying.  I have known so many folks who have a similar story without the happy ending (perhaps they had the same teachers as you ha ha).  They took years of very technical strict lessons learning what the creators of the curriculum thought were important, and became burned out on playing their instrument.  It became too much like work (felt forced upon them) and was not fun.
My guess and observation is that many music teachers, whether teaching privately or in a music school or as part of the curriculum in a regular grade school, are following a set course of instruction developed by music majors who assumed that everyone who learns to play an instrument intends to be a music major all the way through graduate school and perhaps become a professional musician.
It seems that (as you experienced personally) many students are being taught to play an instrument in a manner similar to the way an aspiring mechanic is taught to repair automobiles or a dentist is taught to work on teeth.  The truth is, that many folks simply want to learn to play an instrument for the fun and enjoyment of creating music.  If it feels too much like learning algebra, or trigonometry, it can get to a point where the student develops an aversion to the instrument (like I did to algebra and folks I know have done with piano).
I agree with your premise that an aspiring new musician should first connect with the joy of learning to play some music they personally enjoy and find gratification by quickly (that's a relative term) developing an ability to create or re-create music on their instrument that is meaningful to them.  Then they will become more passionate about learning to improve their skills and may eventually develop a thirst for more in depth knowledge of theory on their own.  I agree with your assertion that most music lessons spend too much time in the beginning on the boring parts and perhaps should get to the fun part faster.
Of course there are some very basic exercises a beginning student must master before he/she can play much on any instrument.  Some basic ideas on how the instrument works, how the notes are laid out, and some hand coordination and basic rhythm exercises are probably fundamental to making much progress with actual music.  But I believe the making music part should come more quickly in the lesson plan than most courses of study seem to dictate.
You also make an interesting point about the lack of creative freedom that many teachers allow their students.  Perhaps a significant portion of the lesson time should be spent on encouraging the student to use whatever he/she has learned towards exercising some creative expression.  The challenge there might be that some students have a difficult time tapping in to their own internal creative abilities - while others seem to thrive on exercising their creative expression.  A good teacher should be able to recognize the difference and modify the teaching style accordingly.
I don't teach piano (my mother did - the old fashioned method book way) but I teach beginner guitar.  My goal with a new student, is to help them quickly get to a point where they can play at least a simple rendition of some songs they like.  Then I expand from there by helping them learn new chords and techniques by incorporating them into the process of learning more songs that the student chooses.
I don't use any books per se - only simple chord charts and lead sheets for arrangements of songs (they choose) that I create for them based on their skill level. The songs in lesson books are often restricted to old songs that are in the public domain due to licensing issues with popular copyrighted songs.
I only teach students who want to learn for fun and after they reach an intermediate level where they are learning new songs on their own, I pass them on to a teacher who will teach them all the music theory they care to know.  Many never get to the theory part because they are having too much fun learning to play more new songs or even compose their own tunes.
In answer to one part of your question - I think many teachers teach the way they teach because A) that's the way they were taught and B) they don't want to reinvent the wheel but rather stick with course outlines and method books that they can just buy and use or C) the school they work at sets the curriculum as a one size fits all with an assumption that the student wants to spend many years learning very slowly and deliberately so they can one day be a professional musician.
The more important part of your question is "Where should I send my kids for them to learn music?"
My recommendation there would be to start them with a private teacher who is flexible, who will assess the abilities and goals of each student on a case by case basis, and who is willing and able to customize the learning process to tailor it to the individual student, and who has a basic philosophy of placing an emphasis on making the learning process fun and rewarding and not feel so academic in the beginning. They are harder to find but I am beginning to see more private teachers incorporating those type concepts into their teaching methods.
You may need to carefully interview a few teachers before you find one to try.  And don't be afraid to change if it becomes apparent that the teacher and student are not clicking. I know students who were on the verge of giving up learning a new instrument until they switched teachers and found the new teacher's approach fit their goals and learning style much better.
Later if your kids develop a more serious interest in music, perhaps you could look into some specialized music schools - but shop around and talk to current students or graduates and try to find the best fit.
Good luck on your new road to musical fulfillment and enjoyment.  Hopefully your kids will follow you.
EDIT: For many students, the traditional teaching methods do work. But it really depends more on the goals, desire, and ability of the individual student.  I think one issue is that music theory is often only taught in conjunction with learning to play an instrument.  While I believe Music Appreciation and Music Theory are valuable subjects in their own right, they are not essential to the process of learning to play and deriving enjoyment from playing an instrument. At some level and at some point, specific elements of theory can help a student do more with their instrument.
I do believe that anyone who takes their musicianship seriously, should learn some music theory eventually.  But I also believe that music theory will be far more interesting as a standalone subject, if it is introduced to a student who first learns to create music on an instrument of their choosing and because they actually want to learn to play that instrument.
This is just my theory (no pun intended), but perhaps music theory and music lessons (for the students chosen instrument) should be taught as separate standalone courses at the beginner level.  They both enhance the other, but neither is dependent on the other.  Advance study on an instrument could eventually begin introducing more theory - as it relates to the students goals with their specific instrument.
FWIW - I also believe that basic education philosophy in the USA (where I live) puts too little value on music education as a whole (but that's just my opinion).
Comment: Of the 3 answers I had until now, this one feels more aligned with my line of thought. Except that I fear that if I don't teach them theory somehow, they may miss the 'understanding the music' part and solely focus on 'feeling the music' part of the musical experience. And that later will make them hit a ceiling. How would you teach them the theory ?
Comment: @darkblue  Music Theory and Music Appreciation are valuable subjects in their own right.  They become even more interesting when the student also plays an instrument.  However, learning music theory is not a requirement for learning to play and derive enjoyment from playing an instrument.  I know private teachers who begin introducing theory to their students who want to learn theory - as they advance in their lessons.  A standalone music theory course might be a good way to teach theory AFTER the student develops a passion for their instrument.  Then they might find theroy more interesting.
Comment: @darkblue  be sure to read my edit at bottom of my answer for more on Music Theory.
Answer: Music sounds fun and easy, but  in reality it's hard work and a lot of study is needed to become a master.
Having this said not everyone wants to become a master. In this sense I think teachers, that have followed a traditional curriculum, don't understand this and just tend to perpetuate the way they learned.
I have had many discussions about this in the past. I think slowly musicians / teachers start to understand this. I know many music teachers that start mixing pop songs on their teaching curriculum to encourage students. Others teachers, as I know some also, just keep insisting and want to teach everyone as they learned. It's not wrong, but they forget that some people want to enjoy music and have a bit more active role. They don't want to become the ultimate masters of Mozart.
In the other hand, let me also say that it's also the role of a teacher to show the whole scope of music to a student and make him understand all its richness, colors and nuances. In this sense it's not possible to teach music without showing the great classics. Modern pop songs are just too basic and poor to ilustrate all the musical spectrum. To pick an example given in another answer, comparing music and math. If your math teacher only teached what you liked you would probably only know how to sum and subtract.
So, to finish, motivation in music is a delicate balance between deepness and student preferences.
Answer: When teaching a number of students together, it's very different from teaching an individual. There has to be a lot more structure, the rate of learning will vary considerably, and there's little time to pander to the individual in a class situation. They don't want to listen to little Jonnie's tune, they want everyone to listen to theirs. So, in a mass situation, the lessons tend to be more static and staid, for discipline reasons if nothing else. Some of those in the class are there in the hope of becoming musical, while others will have a skill almost in-born. It's difficult to keep everyone interested all the time. Paper exercises solve that one. Not ideally, obviously. On a one-to-one basis, it SHOULD be very different, although, as Rockin Cowboy says, a lot of teachers teach like they were taught, thus perpetuating the 'boring' approach.
In my book, theory comes much later. Without actually being able to play something, for a lot of folks, knowing why it works isn't necessary. My analogy is - you don't need to know how a gearbox works to drive a car - especially an auto! Yes, there are some who need to know why things happen like they do, so theory is good for them, but I've found that most of my students didn't need theory first. I've played with many players who have no theory, but it hasn't made them anything else but great players.
Another aspect is that great players do not necessarily make good teachers. A well known fact in any part of education. Some players will supplement their income with teaching, but, possibly because it came easily to them, they expect the same from their students. Often doesn't work. Teaching is very different from performing, a fact not grasped by some.
In answer to your last question, there is probably the curriculum to consider. As with any academic situation, courses need to be followed, with assessment at the end. That in itself is enough to stymie any great teacher who wants to aspire his students. I have questioned too many curricula in years of teaching, usually to no avail! Don't forget that a lot of exam questions are based on 'it exists, so we can make a question on it' rather than 'if it's not going to be useful to more than a few, leave it out'.
Comment: No, the sound you make is **NOT** more important than the way.  If you follow that path  you'll almost certainly develop bad mechanics which at best will keep you from improving past a certain level and most likely will lead to muscle/tendon/voice damage.
Comment: @darkblue The sound you make is thoroughly determined by the way you make it. You could certainly say that there are many different methods and sounds that are interesting or enjoyable to different people, though!
Comment: Exactly why I consider the sausage stuffer approach the wrong one. Children need that one on one time.
Comment: For music theory it was in group, but one one one for piano lessons. I had a few teachers (so they couldn't all be bad ones right? ) and none tried to make me understand the, what i feel is a simple key principle : "the sound you make is more important than the way you make it".  At best what I got from them was : "try to listen to what you play"
Comment: @CarlWitthoft I agree that the way is important too and should not be neglected because it could be dangerous to health, and certain plays require perfect technique. I'm grateful for the technique they taught me but I never was going to become a virtuosos and I am sure it was quite evident but what I was hoping from my teacher was to show and explain me some purpose to guide my learning. This is kind of what I mean by presented "backwards" : we forgot totally the end-goal to concentrate on learning the process. With an end-goal in mind I would probably have picked up the process.
Comment: @MatthewRead I'm not sure I succeeded to fully convey my idea to you. What I meant was suggesting that to progress better you should allow yourself a lot of slack on the way you play to get a better grasp on the sound. By exaggerating variations up to caricature you get a better understanding of why sound "sounds" the way it sounds. The way some of these variations sound to various people will differ but the specific variation that made it to the music sheet of a master usually is more special for some reasons. Once you grasped these reasons the play comes naturally and sounds natural.
Comment: @darkblue All of the theoretical pedagogy and emotional / psychological insight in the world will not help in creating an expressive performance if you yourself lack the ability to physically express your thoughts. Don't get me wrong, I think that for some people who focus *too* much on technique, they lose sight of the end result. For those people, telling them to focus on the end result will usually line things up pretty quickly. That said, the people who benefit from this advice the most are generally people who have developed bad technical habits and obsess over fixing them.
Answer: Not all music schools teach this way. For example, the Suzuki school, here's a link to the UK Suzuki School site:
http://www.britishsuzuki.org.uk/rpmserver/generatorSystem/asp/rpmServer_GoGenerate.asp?intSiteID=15&intPageID=7&intNavbarOpen_Level1_ID=5
Having had similar experiences to the OP, if my children were to take up music, I would try and find something more akin to the Suzuki method for them. If I were to re-do my own musical training, I think I would start with learning to play in a drum group; there aren't lots of notes to learn, its fun, and you learn to play with rhythm and in time with others right from the start.
As to why schools stick to the traditional method - tradition and inertia to change are factors. Being oriented towards the classical tradition. I think very talented students with a natural aptitude for the classical approach might get past all the theory and technique more easily and enjoy it. Perhaps there is even an element of deliberately putting off those that do not take to the approach readily.
Comment: What country did you have your similar experiences in?  I'm in the U.S., and I can't relate at all!
Answer:
There have been many famous musicians who knew almost no theory. Most of them in popular music. I mean popular music going back all the way into history. A Google search shows up Lennon and McCartney, Irving Berlin, George Gershwin and many more.
The great classical composers were great improvisers. They even had competitions where you had to compose a piece on the spot. They called it extemporizing.  Read the biographies of Bach, Liszt and many others.  Bach could immediately improvise a fugue on a theme that someone sang  to him where most people couldn't write one if they had a year and their life depended on it. Liszt could even play with both hands and his nose if pressed.
One way that jazz musicians learn to improvise is by humming a phrase and then immediately imitating it on their instrument. Some do this simultaneously -- you can hear them singing along to their own performance. This even exists as a technique.  You can hear it best on a flute where the voice drastically affects the timbre of the note.

Here's a random link
http://www.jazzadvice.com/the-path-to-playing-what-youre-hearing/

If you want to combine musicianship with exams then you can! You simply have to find a teacher who can teach the right syllabus.

(a) Jazz exams: These include improvisation skills, for example
http://us.abrsm.org/en/our-exams/jazz-exams/
http://www.gsmd.ac.uk/music/principal_study/jazz.html
(b) Musicianship and  Keyboard Harmony exams
I did a brief search for Keyboard Harmony exams and came up with plenty of hits but most seemed to be for commercial firms so I haven't given them because I can't make a recommendation.

The point is that it is absolutely possible to learn the theory alongside improvisation and musicianship skills. Just search around online for teachers near you.
Answer: Being a refugee from traditional music instruction like yourself, I would have to say that music is taught the way it is because it's easy to teach that way.  The dirty little secret about music teachers is that they are largely people who were unable to make performing music their day job.   That means that they teach music not because they love teaching but because they love music.  Not all, maybe not even most.  But a lot.
That can be a problem for students.  I quit playing piano at 14 because my piano teacher picked me up and shook me because I was not playing Bach's Polonaise exactly as it was notated.  In my thirties I discovered that no one even knew Bach was a composer until the mid 1800s.  Previous to that time he was known as the greatest keyboard improvisor who had ever lived.
When I went back to music in my mid-thirties I took up the guitar and I learned it in exactly the opposite way to how I had been trained on classical piano.  I learned in several 10 minute sessions a day, not a continuous hour a day.  I didn't play scales, I played melodies in the scale.  Whenever I was learning a chord progression or voicing, I'd invent a vamp that incorporated that progression and voicing.  I only used musical theory to overcome deficiencies in my own technique.
After a month of learning I was jamming with other musicians weekly and almost every important point of my musical education was initiated by a musician in those jam sessions taking me aside for a couple of minutes and showing me a couple of things.  Those couple of things would keep me occupied for months mastering them.
When I teach music theory to folks, I can do it all in a half-hour.  Musical theory as taught tends to be complicated because very smart people have built their careers on it.  But it's very simple, really, if you have a good ear.
Long story short, if it's working for you then keep on doing it.  If you get stuck and your fellow musicians can't help, then find a teacher.
Comment: I think if you check out the CVs of most famous musicians you would find they have had a surprising amount of musical training. If we follow your example of Keith Richards, he is not a 2-chord wonder. Many pop musicians play down their middle class backgrounds, even if they were boy sopranos and sang in front of the Queen. They still learned chord progressions once upon a time. Yes, once you've done it for 20 years it comes naturally.
Comment: But for me the "big boys" means when I was offered a place in a very good semi-pro big band after years in brass band and school big band. Suddenly people expected me to know "what that sign means", to transpose in my head, to improvise in real time without planning it first. These are things you learn by a combination of practice and theory. If I had not done the theory lessons I would not be able to do what I do now. Having said that, in the old band we still have fun without thinking hard. But no-one's paying to see us play. Both paths are valid.
Answer: I personally feel that music should be made fun, and should emphasize learning to play by ear, right at the beginning. Technique and dexterity can be developed at the same time but the emphasis should be on learning melodies and harmonies and how to play these back by ear. The reason I say this is that I've known a lot of musicians, the ones who could play by ear were playing the kind of music they wanted in bands, while the ones who learned the music-school way were stuck playing off of sheet music and had a hard time assimilating into bands.
Answer: Music schools exist to teach you theory and technique. If you don't want to learn either one, then there is no reason for you to be there. That sounds harsh, but it's true. Often, I think kids get thrown into music school for perfectly good reasons, but the kids aren't mature enough to take on the challenge. I know I wasn't. Just like you, I hated it, and eventually I convinced my parents to let me stop. Fast forward 20 years and I wish I had kept it up. But I'm glad I didn't, because I really did hate it.
In my case, I ended up changing instruments to guitar, for which I am mostly self taught. I am a pretty good player. I have mastered the technique, but I will never master the theory, and I'm okay with that. I know enough to be dangerous, and every once in a while I learn a little more. It's good enough.
Comment: I'm glad that time also allowed you to turn an horrible experience into a more satisfying one. Mine didn't feel as horrible as you describe but rather pointless. I'm more on the theory side rather than technique but I get what you say. It may have been a maturity issue, but I feel it's more that the tracks weren't pointing in the direction I wanted to go. I could have boarded the train if I had a convincing enough teacher. But now, retrospectively I would rather have had a teacher that would have built custom tracks just for me but used his expertise to still guide me to interesting lands.
Answer: The initial goal may be misunderstood. If the goal is to develop a professional musician, then it may be more important to start form very basics and spend lots of time on fundamentals and relatively simple exercises, even if they are boring. Seems more honest to play a really good pieces from the past, and play them as they are (significant simplifications are often possible, but, of course, the quality suffers).
If the goal is to learn music not for profession, it may be more interesting to learn more playable songs and melodies (rather than exercises) and maybe even some basic rules how to create or improvise (blues scale, for instance, or to tell that quint interval often sounds good enough). Also, may be more attractive to learn recent pop after simplification whenever possible. This may make more fun but the way to the professional musician will be longer with this approach.
Comment: *"If the goal is to develop a professional musician, then it may be more important to start form very basics and spend lots of time on fundamentals and relatively simple exercises, even if they are boring."* -- I couldn't disagree more.  And if you read biographies of the greats, I don't think you'll find that their early musical education was boring.
Answer: I think partly the answer to "why is music taught as it is" is tradition:
Imagine if a (non-musical- no preconceived ideas) parent spotted some ability in their child, and sent them for music lessons. Money changes hands (probably) so there is automatically an expectation about marked progress . That implies an understood curriculum / set of milestones etc, which probably takes the informality out of it and sets it up as a course after which students will have had music 'done at them'.
Or consider an alternative teaching method:
After a few lessons you ask your child about progress and they say "oh we just found our own way really and ...er .. I'm currently mucking about in E"
You might have a word with the music teacher about what your money is buying !
Maybe the informal 'find it yourself' method can't be taught, or isn't formal enough to determine progress?
I know of many people whose parents spotted they could play a bit, sent them for music lessons, and that trained the enjoyment out of it. It's a common occurance, to the point where I can't help but conclude if you want your kids to ENJOY music, the last thing you should do is SEND them for lessons. Either wait until they ask for lessons (make sure they know they can if they want), or just let them find the music themselves.
As a side note, it occurred to me that possibly the reason music notation was invented was because, at the time, it was the only way of making a "recording": Sound recording hadn't been invented so there had to be some way of noting how a piece of music went without it being different or bits forgotten every time it's played; to formalise it. That would have been the case for hundreds years until the first recording devices appeared, so if you wanted to learn a piece you either listened to someone playimng it from sheet music it or learnt to read it yourself.
However if you wanted to find your own way and just make a sound, then that method has been around since people first banged a bone on a tree log, and it's not going away anytime soon. Just ask Mr Hendrix  ;-)


Pegar o caminho de uma imagem na Galeria

Question: Como eu posso fazer para pegar o caminho da imagem que eu acabo de fazer o upload para depois salvar no banco de dados com o caminho?
Eu pego a imagem da Galeria, logo em seguida com essa imagem eu queria pegar o caminho e salvar no banco SQLite.
Sou meio leigo no assunto :(

     ImageButton contactImgView;
        private String imagePath;

       public void tela_cuidador_cadastrar_tema(){

 setContentView(R.layout.tela_cuidador_cadastrar_tema);

 contactImgView = (ImageButton) findViewById(R.id.imageButton1);

    //Procura Imagem da galeria

    contactImgView.setOnClickListener(new View.OnClickListener(){

       public void onClick(View v){
              Intent intent = new Intent();
              intent.setType("image/*");
              intent.setAction(Intent.ACTION_GET_CONTENT);
              startActivityForResult(Intent.createChooser(intent, "Select Contact Image"), 1);

     }
    });
}
@Override
public void onActivityResult(int reqCode, int resCode, Intent data) {
 super.onActivityResult(reqCode, resCode, data);
    if(resCode == RESULT_OK)    {
        if (reqCode == 1)
            contactImgView.setImageURI(data.getData());
         Uri imageUri = data.getData();
         imagePath = getImagePath(imageUri);
            Toast.makeText(MainActivity.this, imagePath, Toast.LENGTH_LONG).show();

    }
}

public String getImagePath(Uri contentUri) {
    String[] campos = { MediaStore.Images.Media.DATA };
    Cursor cursor = getContentResolver().query(contentUri, campos, null, null, null);
    cursor.moveToFirst();
    String path = cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA));
    cursor.close();
    return path;
}

Só que a mensagem que era para ser exibida, aparece em branco e não o caminho :S .
Answer: Se estiver a obter a imagem da Galeria usando Intent.ACTION_PICK pode, no método onActivityResult(), usar Uri imageUri = intent.getData(); para obter o Uri aos dados da imagem. Use o método getImagePath() para ler o path dela.
private String imagePath;
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
    super.onActivityResult(requestCode, resultCode, intent);

    switch (requestCode) {
    case REQUEST_PICK_IMAGE:
        if(RESULT_OK == resultCode){
            Uri imageUri = intent.getData();
            imagePath = getImagePath(imageUri)
            ......
            ......
        break;

    default:
        break;
    }
}

public String getImagePath(Uri contentUri) {
    String[] campos = { MediaStore.Images.Media.DATA };
    Cursor cursor = getContentResolver().query(contentUri, campos, null, null, null);
    cursor.moveToFirst();
    String path = cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA));
    cursor.close();
    return path;
}

Comment: Ola Ramaral, editei o meu post com a sua resposta e deixei o meu código do seguinte jeito. Só que ainda esta dando problema, não sei se eu que sou muito leigo e não entendo ou  realmente não deu, por favor, se puder me ajudar de acordo com o meu código acima, serei muito grato
Comment: Você está a usar `Intent.ACTION_GET_CONTENT` e a criar um *Chooser*, note que o meu código só funciona se estiver a usar a app *Gallery* do Android.
Comment: Isso, so que eh em um ImageButton, ai o usuario pega da galeria a imagem,  aparece no ImageButton, logo em seguida ele aperta o botao de cadastrar e salva no banco o caminho daquela imagem
Comment: Editei o método `getImagePath()`
Comment: Eu usei o seu método modificado getImagePath  só que esta me voltando vazio ainda, eu vejo que esta vazio usando:  Toast.makeText(MainActivity.this, imagePath, Toast.LENGTH_LONG).show();
Comment: Estive a testar o código, indo buscar uma imagem à **GALERIA**, e ele funciona bem.


Parameters for a JS - which is the best way?

Question: I want to load a JS and his behaviour should differ depending of one parameter. I thought one of the ways to do this could be:

...

Then, I would obtain the parameter using regex, like:
function getURLParameter(name) {
    return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search)||[,""])[1].replace(/\+/g, '%20'))||null;
}

(above function from here).
However, I'm not sure if this is the best approach for this. Do you suggest any other way to do this, like, loading global variables inside the  and then read them from the JS?
Comment: behave differently how? Is it possible for the parameter to change the output of the js file? Also does it make sense that the parameter could change multiple times?
Comment: I don't see anything in your question related to regex other than tangentially in your source code.
Comment: I think that is enough to put the tag in my question? If it is not, feel free to remove it (you or any moderator).
Answer: There may be a better way to organize your code in general, but an easier way to configure a parameter than a URL query would be to simply call the defined functions with an argument:
External script (foo.js):
function foo(param) {
    console.log(param);
}

HTML:

Edit: Here's an example of "configuring" a parameter without immediately calling anything (basically, a simple closure):
function (param) {
    $(document).ready(function () {
        // Use param
    });
}

$(document).ready is already an async call so this is simpler than it might be otherwise, but in general you can use an IIFE (Immediately Invoked Function Expression): (function (param) { })(paramValue)
Comment: I forgot to say (sorry) that my script is $(document).ready based, so it's not the solution I was looking for but I know what you mean, thank you though.
Comment: You can still do it fairly easily. I'll amend my answer with an example.
Comment: I think this is the smartest way to do what you're asking without knowing much more about your specific rules. Url param would be a hacky way to achieve what this solution is doing. Plus you have the added bonus of being explicit in your intent.
Comment: I think I'm following this approach to do what I want to do. It seems clean and won't cause any issue in the future at first glance imho. Thank you for your help!
Answer: The getURLParameter function you have given will use the URL that you see in the address bar, not the one the

Comment: Fair enough - I suppose it depends on how complex your parameters are going to be and how often you will use them.  I only made this suggestion as I had done a little research into parameters before and found this to be the best way in that case.
Comment: This looks like a maintenance nightmare.
Comment: I would not do this. Magic global variables are a headache.
Comment: I thought about this as I mentioned, but I think it's not the most elegant solution and, as said above, kind of a nightmare to maintain?
Answer: You can make your javascript in php and use
var parameters = <?php echo json_encode($_GET); ?>
function getURLParameter(name) {
    return parameters[name];
}

Comment: It has to be pure javascript. I used that workaround in the past but I'd prefer to get rid of it in this case (otherwise I would have to run PHP support for my script in my server).


Prove: $\dfrac{|x|}{|y|}=\left|\dfrac{x}{y}\right|$

Question: Can you help me to prove that
$$\dfrac{|x|}{|y|}=\left|\dfrac{x}{y}\right|$$, if $y\neq 0$.
Comment: Well, do the four cases.
Comment: I see that you asked 3 separate questions based on the modulus property.  Maybe you should have posted all of them at once and asked if you had a specific query. What exactly is troubling you?
Answer: Suppose $|ab|=|a||b|$.
Then let $a=x$ and $b=1/x$ to get
$$1 = |x \cdot \frac{1}{x} | = |x| | \frac{1}{x}|$$
Rearrange to get $|\frac{1}{x}| = \frac{1}{|x|}$.
Now let $a=x$ and $b=1/y$. Then
$$\left| \frac{x}{y} \right| = \left| x \cdot \frac{1}{y} \right| = |x| \left| \frac{1}{y} \right| = |x| \frac{1}{|y|} = \frac{|x|}{|y|}.$$
It is up to you to show $|ab|=|a||b|$.
Answer: It follows directly from Prove: $\Big|\dfrac{1}{x}\Big|=\dfrac{1}{|x|}$ and Prove: $|xy|=|x|\cdot |y|$
$$\frac{|x|}{|y|}=\frac{1}{|y|}|x|=\left|\frac{1}{y}\right||x|=\left|\frac{x}{y}\right|,\quad y\neq 0$$


r - Plot polygons in a list of dataframes with leaflet

Question: I have a list with 88 polygons, where each one is just a dataframe with a lat column and a long column, is there an easy way to plot this polygons in leaflet?
For example, mi data is in the format of the variable example, shown here
df1 <- data.frame(lon=c(-71.53700 -71.51676 -71.51682 -71.51524 -71.53921 -71.53700), lat=c(-32.94082, -32.93327, -32.93325, -32.92814, -32.93408, -32.94082))
df2 <- data.frame(lon=c(-72.11527, -72.09601, -72.08983, -72.10905, -72.11527), lat=c(-36.61267, -36.61720, -36.60192, -36.59682, -36.61267))
example <- list(df1, df2)

Comment: Adding a reproducible example would be useful, but you could do this with `sf`. Convert to points. `summarise` to union the points, `st_cast` to polygon
Comment: edited to include an example! thanks! i will try what you posted :)
Answer: Here's an example of converting your points to polygons via sf. Note that your first polygon is basically a line so I only plotted the second one.

library(tidyverse)
library(sf)
library(leaflet)

df1 <- data.frame(lon=c(-71.53700 -71.51676 -71.51682 -71.51524 -71.53921 -71.53700), lat=c(-32.94082, -32.93327, -32.93325, -32.92814, -32.93408, -32.94082))
df2 <- data.frame(lon=c(-72.11527, -72.09601, -72.08983, -72.10905, -72.11527), lat=c(-36.61267, -36.61720, -36.60192, -36.59682, -36.61267))
example <- list(df1, df2)

polys <- example %>%
  bind_rows(.id = "df_id") %>%
  st_as_sf(coords = c("lon", "lat"), crs = 4326) %>%
  group_by(df_id) %>%
  summarise(geometry = st_combine(geometry)) %>%
  st_cast("POLYGON")

leaflet(polys[2, ]) %>%
  addPolygons()


Image File field not getting updated

Question: Form function:
$form['upload_photo'] = array(
        '#type' => 'file',
        '#title' => t('Upload Your Photo'),
        '#title_display' => 'before',
        '#states' => array(
            'visible' => array(
                ':input[name="testimonial_type"]' => array('value' => 'Text'),
            ),
        ),
        '#prefix' => '
',
        '#suffix' => '
',
    );

Submit function:
$field_collection_item = entity_create('field_collection_item', array('field_name' => 'field_text_testimonial_info'));
$file_d = $form_state['values']['upload_photo'];
                $file = file_load($file_d);
                $file->status = FILE_STATUS_PERMANENT;
                file_save($file);
                file_usage_add($file, 'user', 'TYPE', $file->fid);
                $file_info = image_get_info($file->uri);
                $file_arr = array(
                'fid' => $file->fid,
                );
                $field_collection_item->field_client_image[LANGUAGE_NONE][0] = $file_arr;
                $field_collection_item->setHostEntity('user', $user);
                $field_collection_item->save();

After submit I am getting below error:

Notice: Undefined property: stdClass::$uri in file_save() (line 614 of /public_html/includes/file.inc).
Notice: Undefined property: stdClass::$filename in views_data_export_file_presave() (line 278 of /public_html/sites/all/modules/contrib/views_data_export/views_data_export.module).
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 'uri': INSERT INTO {file_managed} (filesize, status, timestamp) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2); Array ( [:db_insert_placeholder_0] => 0 [:db_insert_placeholder_1] => 1 [:db_insert_placeholder_2] => 1535026403 ) in drupal_write_record() (line 7386 of /public_html/includes/common.inc).

Kindly help me to solve it out
Answer: Maybe this can help How to upload file in drupal8 forms with form element type file?
I see for your use case it makes more sense to use Managed file type.
A couple of observations, something you should look at,

It seems you are getting SQL errors due to trying to upload a file which is already present in the table, you should check why this happens and perhaps programmatically change the name of the file if it already exists. See file_save_data
Errors from views, not sure where you are trying to submit this form, but it is clearly breaking something in views_data_export or it maybe because of the next point.
Lastly, check the link above for how to properly handle file uploads in form, it looks like file_save($file); is breaking for you due to missing uri

Image File field not getting updated


Change URL that is displayed in non-HTML5 browsers (without reloading the page)

Question: I'm wondering if there is a way to change the URL that is displayed in a browser that does not support HTML5? I update some pages using AJAX, so it would be useful to be able to do this to allow users copy and paste links.
Thanks.
Comment: i find it hard to understand exactly what you mean `change the URL that is displayed in a browse` and `allow users copy and paste links`
Comment: @david At the top of any page the URL is displayed. I am updating page content using AJAX, but doing this doesn't update the URL that is shown to the user. If a user called Geoff likes the contect and thinks "I'll copy that link and share it with Bob", then he will be copying the wrong URL, directing Bob to the origianal page that Geoff viewed.
Answer: Usually, website programmers that want to change the site URL when using AJAX, add a hash to the URL (#) and then a page component specific URL.
To change the hash itself use window.location.hash.
However, since the browser does not send the hash portion of the URL to the server, you'll need some code to send that part explicitly to the server to fetch the right content.
There are several jQuery plugins that deal with this issue, for example http://plugins.jquery.com/plugin-tags/hash, and there are many questions here that deal with the subject:
Getting URL hash location, and using it in jQuery
Encoding of window.location.hash
Parsing URL hash/fragment identifier with JavaScript
These are just a few examples.
Comment: Ok, so basically all I could do with the older browsers is - http://mydomain.com/#page_name, which when navigated to would cause my site to say "hang on, there is a # there - thats load the content for http://mydomain.com/page_name"?
Comment: Actually, that's true for the newer browsers as well. The main difference is, that in older browsers you didn't have an event if the hash value changed. So, if the user navigated (say, pressed the back button) within your site, a new request wouldn't get sent.


Listing left and right cosets

Question:
List the left cosets $(gH)$ and right cosets $(Hg)$ for $H = \langle (123) \rangle$, where $H \le G$ and $G = S_3$.

My work so far:
$G = S_3 = \langle (12) (13) \rangle = \{ e, (12), (13), (23), (123), (132) \} $
$H = \langle (123) \rangle$
I have trouble listing out all the elements with $H$, as I'm rather iffy with generators and permutations put together. I believe this would help me tremendously on finding the cosets.
Comment: You are new to cosets, so how about this: (i) list out all of the elements of $H$, (ii) for all six elements of $S_3$ compute the corresponding coset of $H$, (iii) identify all redundancies in the resulting handful of six cosets (numerically, there should only be two *distinct* cosets).
Comment: That's correct. First you start with $e$ and $(123)$. You square $(123)$ and get $(132)$. Apply $(123)$ again and you are back at $e$. So you are done - those are the elements of $H$. Now, about those cosets ... you already have the left cosets $eH$, $(123)H$ and $(132)H$. (Do you understand what they are and why you have them?) Compute the other "three" (note - they will all be the same).
Comment: Going back to using $H = \langle (123) \rangle$ and $G = S_3$, my left cosets are $(12)H = \{(12), (23), (13) \}$ and $(123)H = \{(123),(132),e\}$. My right cosets are $H(12) = \{(12),(13),(23) \}$ and $H(123) = \{(123), (132), e \}$. I just realized that all the left and right cosets are equal to each other (i.e. $(12)H = H(12)$ and $(123)H = H(123)$, so $H$ is also a normal subgroup!
Comment: That's what I'm having trouble with precisely right now: listing all the elements of $H$. My initial guess is $H = \{e, (123), (132)\}$ ...
Comment: Just to be sure that I firmly understand this: I also have another part of the exercise where $G = S_3$ still but now I get a different $H$, that is, $H = \langle (12) \rangle$. When I first multiplied $e$ by $(12)$, of course I get $(12)$. Now if I do $(12)(12)$, then I got back to $e$. So would it be $H = \langle (12) \rangle = \{e, (12) \}$?
Comment: The equation $\langle(12)\rangle=\{e,(12)\}$ is also correct.
Comment: Good job. Yes, $H$ is normal (one could also argue this by saying it is the only subgroup of three elements, because it contains all elements of order three).
Comment: I had a question similar to this. Thank you @anon, you explain this well
Answer: Given $G = S_3 = \{e,(12),(13),(23),(123),(132)\}$
and $H = \langle 123 \rangle = \{e,(123),(132)\}$,
we have
$$eH=\{e,(123),(132)\} \text{ and } He = \{e,(123),(132)\}$$
$$(12)H=\{(12),(23),(13)\} \text{ and } H(12) = \{(12),(13),(23)\}$$
$$(123)H=\{(123),(132),e\} \text{ and } H(123) = \{(123),(132),e\}$$
All cosets of $H$ have been listed. We also see that $eH=He$, $(12)H=H(12)$. and $(123)H=H(123)$. In this case, $H$ is normal subgroup in $G$.

Listing left and right cosets


I am not able to see the value of variable in jsp page when i hover the mouse on it

Question: I am not able to see the value of the variable in JSP page. When I hover the mouse on it. It shows the type of the class. I am in debug mode and I am checking the variable after the line is executed. It works absolutely fine. When I see variables in java file. both the files are in the same project.
window >> preference>>java/j2ee>>editor>>hovers
....combined hovers are checked...
Comment: eclipse s the ide used
Comment: select the variable (by mouse) and press ctrl+shift+i
Answer: select The variable and
press Cntrl + shift + i
and you will get value of selected variable in debug mode
Answer: I ran into same issue recently. I found this. It might be helpful for you.
Also one quick workaround is that you can punch out System.out.println() statements to check the values. It might be painful though, and make sure to remove them once you are done.
Comment: OK so I learnt that there is no straightforward way to inspect the variable values. One simple way is to use sysout statements as I already mentioned in the answer. I am not sure if at all there is a way to achieve this.


Como multiplicar o valor de 3 inputs usando javascript puro?

Question: Estou tentando fazer a multiplicação de 3 campos, o valor total será retornado em um novo label. Porém não estou conseguindo. Quando fiz com 1 campo apenas, funcionou:
http://jsfiddle.net/dorathoto/PLrCK/
Até tentei fazer um if (isNaN( porém não adiantou. Não apresenta erro, porém não funciona!
Comment: O teu problema é que ao fazeres onchange de um elemento estás a passar uma string e não um conteudo
Comment: creio que tera de fazer o onchange somente no ultimo para ter todos os 3 parametros se não nao vai ter jeito
Answer: O teu problema é que ao fazeres o onchange estás sempre a passar duas string's, logo vais multiplicar o valor da input que estás a passar (correctamente) mais duas strings.
O teu erro estava:
onchange="MudaPreco(this.value,'txt_Largura_1','txt_Inclinicacao_1','PrecoProd_1')

E o que a função ia receber era:
function MudaPreco(4, txt_Largura_1, txt_Inclinicacao_1, PrecoProd_1)

Assim ao fazeres o calculo da var Total ficava:
var Total = 4* txt_Largura_1* txt_Inclinicacao_1

Eis o que te aconselho a fazer:
    comprimentoID = $('#txt_Comprimento_1').val();
    LarguraID = $('#txt_Largura_1').val();
    InclinacaoID = $('#txt_Inclinicacao_1').val();

    var Total = comprimentoID * LarguraID * InclinacaoID;

Deixo JSFIDDLE com um exemplo de resolução.
EDIT: Sem JQuery
Podes usar o document.getElementById('txt_Comprimento_1').value que é nativo do javascript.
LINK sem jquery.
Comment: Certo, vou editar
Comment: Agradeço a resposta, realmente funciona, porém por outros motivos estou a implementar em javascript puro, porém caso não consiga vou utilizar sua solução.
Comment: `document.getElementById` é javascript puro. Estás a vontade :)
Comment: agora vi que esta 100%, valeu
Answer: Altere a sua variável total:
 var Total = document.getElementById(comprimentoID).value * document.getElementById(LarguraID).value * document.getElementById(InclinacaoID).value;

O problema é que você está passando para a função o ID do campo que contém o valor que precisa ser multiplicado.
Altere também o evento onChange de cada campo, no lugar de passar o valor preenchido no campo comprimento, passa o ID do campo:
<input id="txt_Comprimento_1"  type="number"   onchange="MudaPreco('txt_Comprimento_1','txt_Largura_1','txt_Inclinicacao_1','PrecoProd_1')" />

<input id="txt_Largura_1" type="number" onchange="MudaPreco('txt_Comprimento_1','txt_Largura_1','txt_Inclinicacao_1','PrecoProd_1')"   />

<input id="txt_Inclinicacao_1" type="number" onchange="MudaPreco('txt_Comprimento_1','txt_Largura_1','txt_Inclinicacao_1','PrecoProd_1')"  />

Comment: Assim só funciona para o primeiro `onchange`
Comment: @CesarMiguel funciona para todos. O valor só vai ser calculado após preencher os 3 campos, caso contrário ocorre uma multiplicação por 0.
Comment: Funciona se alterares o comprimentoID que tens ai
Comment: @CesarMiguel entendi, vou alterar.


Function integrable over the interior but not over the set

Question:
Let $S$ be a bounded set in $\mathbb{R}^n$; let $f:S\rightarrow\mathbb{R}$ be a bounded continuous function; let $A$ be the interior of $S$. Give an example where $\int_Af$ exists and $\int_Sf$ does not.

There's a theorem that says if $\int_Sf$ does not exist, then for a set $E$ of measure nonzero of points $x_0$ on the boundary of $S$, the condition $\lim_{x\rightarrow x_0}f(x)=0$ fails to hold.
So we must select $S$ at least to meet that condition. In particular, the boundary must have measure nonzero. But whenever we pick a connected region in the plane, for example, the boundary has measure zero. So I'm not sure which set $S$ to pick here.
Answer:
But whenever we pick a connected region in the plane, for example, the boundary has measure zero.

That is not true, only you can't visualise sets where it isn't the case well, these beasts are very complicated.
Let $C \subset [0,1]$ a fat Cantor set, and $U = [0,1]\setminus C$. Then $A = U\times[0,1] \cup [0,1]\times U$ is connected and its boundary $C\times C$ has positive measure. Take any non-measurable subset $N$ of $C\times C$, and let $S = A \cup N$. Let $f \equiv 1$.
then $\int_A f$ exists ($A$ is open, and hence measurable, it is contained in $[0,1]^2$ so has finite measure), but $\int_S f$ does not exist because $S$ is not measurable.
Comment: This is the first time I've seen the fat Cantor set (I've only seen the Cantor ternary before). Why is $A$ connected and $C\times C$ has positive measure?
Comment: A fat Cantor set has positive ($1$-dimensional) Lebesgue measure (that's what makes them "fat"), and the measure of the product of two measurable sets is the product of the measures. So $C\times C$ has positive measure. To see that $A$ is connected, let $\xi \in U$. A point $(x,y) \in U\times[0,1]$ can be connected by a path (straight line segment) in $U\times[0,1]$ to $(x,\xi)$. That can be connected by a straight line segment in $[0,1]\times U$ to $(\xi,\xi)$. For $(x,y)\in [0,1]\times U$, use first a horizontal segment, then a vertical segment to connect it to $(\xi,\xi)$.


An implication concerning $\operatorname{range}T\cap\operatorname{null}T = \{0\}$

Question: Is the following argument correct?

Proposition. Given a finite-dimensional vector space $V$ and a linear map $T:V\to V$ such that $\operatorname{rank}(T^2) = \operatorname{rank}(T)$ prove that $\operatorname{range}T\cap\operatorname{null}T = \{0\}$.

Proof.  Assume that there exists at least one non-zero vector $v\in\operatorname{range}T\cap\operatorname{null}T$ and let $U$ be the linear map formed by restricting the domain of $T$ to $\operatorname{range}T$ then the rank-nullity theorem implies
$$\dim\operatorname{range}T = \dim\operatorname{null}U+\dim\operatorname{range}U = \dim \operatorname{null}U+\dim\operatorname{range}T^2$$
Now since $\operatorname{range}T\cap\operatorname{null}T\subseteq\operatorname{null}U$ it follows that $v\in\operatorname{null}U$ and thus $\dim\operatorname{null}U\ge1$ consequently $\dim\operatorname{range}T^2<\dim\operatorname{range}T$.
$\blacksquare$
Comment: Seems perfect to me.
Answer: Here is another take, which avoids contradiction.
$\operatorname{rank}(T^2) = \operatorname{rank}(T)$ implies $\dim \operatorname{null}(T^2) = \dim \operatorname{null}(T)$.
Since $\operatorname{null}(T) \subseteq \operatorname{null}(T^2)$, we have $\operatorname{null}(T^2) =\operatorname{null}(T)$.
Now, let $v \in \operatorname{range}T\cap\operatorname{null}T$.
Write $v = Tw$. Then $0 = Tv = T^2 w$ and so $w \in \operatorname{null}(T^2) = \operatorname{null}(T)$.
Therefore, $v=Tw=0$.


difference between GLM covariance matrix from MLE vs. IRLS for non-canonical link

Question: Someone asked a question on Stack Overflow where they noted a difference between Minitab and R (glm) results for the variance-covariance matrix of the parameters, for a probit-link binomial model.

Minitab's algorithm is not well described, but fitting the same model in glmmTMB (which uses general MLE rather than IRLS, and inverts the Hessian estimated from finite differences of the (automatically generated) gradient at the MLE) gives very close answers to the Minitab result.
The coefficient estimates are very similar
glm() instead uses the QR decomposition based on the weighted least-squares solution at the last step of an IRLS algorithm (see here, here).
The data set is very small (2 parameters estimated from 4 observations), so I'd expect any asymptotic assumptions to be pretty poor
refitting the same model with the canonical logit link instead of the probit gives very similar answers between glm (IRLS) and glmmTMB (MLE/Hessian)

I know that the Fisher information matrix is equivalent to the Hessian only in the case of a canonical link (see here); I believe that optimization based on these two approaches reaches the same point, but perhaps the estimate of the covariance matrices still differs?
Comment: Yeah, I tried just changing `episolon=1e-20` for `glm`, and while this moves the point estimates significantly closer to Minitab's in terms of relative difference, it moves the the vcov differences in a very minimal amount in terms of relative difference. So I don't think it's just differences in precision.
Comment: Note that there is some difference in the estimates (~0.00013 for b1). While the difference of the estimates may be fine for the point estimates, it may be enough to have a significant difference in the variance estimates?
Comment: Maybe, but the differences seemed too large to be accounted for by that variation (not a proof or even a demonstration, just a feeling).  (I haven't checked the `glm()` vs `glmmTMB()` differences in point estimates for the logit case, where the covariance matrices are very similar ...)
Answer: The likelihood score for a glm is
$$U_i= x_i\frac{d\eta}{d\mu}V^{-1}(\mu)(y-\mu)=D^TV^{-1}S.$$
The derivative of this product has three components, two of which are multiples of $S$ and so are mean zero and the third of which is $D^TV^{-1}D$. The expected Fisher information is thus $D^TV^{-1}D$, but the observed Fisher information (Hessian) is more complicated.
R (following GLIM and McCullagh & Nelder) uses the expected information. If glmmTMB uses the Hessian directly then it will be getting the observed Fisher information.
The point estimates are the same either way: they are the values that solve $\sum_i U_i(\beta)=0$.  The variance estimates will not be identical; they will be different consistent estimates of the same true value.
Efron and Hinkley argued that the observed information should give better confidence intervals than the expected information. The difference is pretty small and in most settings people use whichever one is easier to compute -- just as you see here, where the expected information is easier to compute in the context of glm and the observed information is easier in the context of automatic differentiation software designed for more general MLEs.
Comment: Could you clarify what the variables in your score equation are?


Sends all messages with the same sessionId to the dead letter queue on Azure Service Bus Queue

Question: I am working with an azure service bus queue configured to be FIFO (First input first output). I work on an order application with the following states "Pending", "Received" and "Sent". therefore I have grouped the messages by the "SessionId" service bus option, setting the orderId as sessionId so that it processes the messages in order in case of horizontal scaling.
So far it works perfectly, the problem I have found is when a message in "pending" or "Received" status fails due to a timeout and goes to the dead letter queue. The message in "sent" status is processed correctly and then when the support team re-sends the "Pending" or "Received" status message to the queue it is processed correctly marking the order in a previous status instead of "sent" ".
I can think of several ways to control this, for example that the support team looks at the status of the order before reprocessing the message from the dead letter queue :) but I would like to know if service bus offers the possibility that if there is a message in the dead letter queu all the messages in the session queue that have the same sessionId go to the dead letter queu. Finallly, my question is:
Is there a way to configure azure service bus so that if there are any messages in the dead letter queue it sends all messages with the same sessionId to the dead letter queue?
Thank you very much!!!
Answer:
You can try this code to read Dead Letter from Queue.
public static async Task GetMessage()
        {
            string topic = "myqueue1";
            string connectionString = "Endpoint = sb://xxx.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=xxx";

            var servicebusclient = new ServiceBusClient(connectionString);
            var reciveroptions = new ServiceBusReceiverOptions { SubQueue = SubQueue.DeadLetter };
            var reciver = servicebusclient.CreateReceiver(topic, reciveroptions);
            // 10 number of message read from Queue
            await receiver.PeekMessageAsync(10);

        }

after receiving message from Dead Letter you can send to queue.
As per Microsoft official documents

There's no automatic cleanup of the DLQ. Messages remain in the DLQ
until you explicitly retrieve them from the DLQ and call Complete() on
the dead-letter message.

These following document help you.
Thanks Casually Coding for posting post on Read Message from the Dead Letter Queue
Microsoft Documents  Using Dead-Letter Queues to Handle Message Transfer Failures , Receive Message from Dead letter queue
Answer:
I would like to know if service bus offers the possibility that if there is a message in the dead letter queue all the messages in the session queue that have the same sessionId go to the dead letter queue.

No, there is no such offering by Service Bus by default.

Is there a way to configure azure service bus so that if there are any messages in the dead letter queue it sends all messages with the same sessionId to the dead letter queue?

Yes, you can do that. You can first peek the messages in your dead-letter queue to fetch all the session ids. Then you can receive the messages in your main queue whose session id is in the DLQ, and then move those messages to DLQ. Here's one such logic I've implemented in dot net using the latest version of Service Bus SDK.
var queueName = "<queue>";
var connectionString = "<connection-string>";

var client = new ServiceBusClient(connectionString);

var sessionIdInDLQList = new List<string>();
var receiver = client.CreateReceiver(queueName, new ServiceBusReceiverOptions { SubQueue = SubQueue.DeadLetter });
var message = await receiver.PeekMessageAsync();
while (message != null)
{
    if (!sessionIdInDLQList.Contains(message.SessionId))
        sessionIdInDLQList.Add(message.SessionId);
    message = await receiver.PeekMessageAsync();
}

foreach (var sessionId in sessionIdInDLQList)
{
    var session = await client.AcceptSessionAsync(queueName, sessionId);
    message = await session.ReceiveMessageAsync(TimeSpan.FromSeconds(20));
    while (message != null)
    {
        await session.DeadLetterMessageAsync(message, "Message with this session is to be dead-lettered!");
        message = await session.ReceiveMessageAsync(TimeSpan.FromSeconds(20));
    }
}

In your case, you need to do this before your consumers start reading the messages, probably you can write this in your consumer application or any trigger application like Azure Function or worker role. That's upto your method of handling.


Reading binary data C (open, read)

Question: I'm trying to read a png file with read() and open() in C, but all I'm getting is corrupted data. Here is my code :
int  r;
int  fd;
char buff[4097];

fd = open("image.png", O_RDONLY);
while ((r = read(fd, buff, 4096)) > 0)
{
    buff[r] = '\0';
    printf("%s", buff);
}
close(fd);

The 8-10 first bytes are the same and then the data is corrupted and doesn't match at all the original image.
Thanks for your help
Comment: Well, you are reading some binary data and try to print it with "%s" so if, for example, there is null character(0x00) in your image data you will not see the data after that character. So, it is perfectly normal that you don't get a matching result.
Comment: How does this data not "match at all the original image"? Are you aware that (1) in a PNG image, the image data may not follow immediately after the header, and (2) it is LZW compressed? In other words, are you aware there is a [PNG Format Specification](http://www.libpng.org/pub/png/spec/1.2/PNG-Structure.html)?
Comment: Okay I see! Yes I'm aware of PNG specification, I'm handling this later in my code, first I'm just trying to get the binary data in order to process it.
Answer: One should not expect to be able to read a binary file and print it as a string. In order to see what is actually in your file, print it as something more suitable for the binary format - say, hex:
int i = 0;
while ((r = read(fd, buff, 4096)) > 0) {
    for (int j = 0 ; j != r ; j++ ) {
        printf("%02x ", buff[j]);
        if (i % 16 == 0) {
            printf("\n");
        }
        i++;
    }
}
printf("\n");

Note that this code simply grabs raw bytes from your image file, without making any attempt at interpreting it. Your file may be compressed, too, so trying to interpret it may be a complex task.
Comment: And the image data in a PNG file in particular is *always* compressed.

Reading binary data C (open, read)


Using Windows Jobs with Service Fabric

Question: I have a microservice deployed to a Service Fabric Cluster.  The service is misbehaving in its CPU consumption and degrading performance of other services running along side it on the same VM.  We have diagnostic information that is leading us down a path to fix it, however in the mean time we need it running in a governed state until we can verify the fix.  Our cluster is not set up as of right now to work with Containers, and that may be a longer term solution for things like this in the future.  However, in the short term, is there any danger to how Service Fabric normally operates to registering this service as a Windows Job and limiting its CPU consumption?  We have tested it and it appears to work, but we want to make sure this won't have side effects to how Service Fabric operates.
Answer: Yup, you can just configure Resource Governance to limit the process to some number of cores.  Docs here.
<code>  <ServiceManifestImport>
    <ServiceManifestRef ServiceManifestName='ServicePackageA' ServiceManifestVersion='v1'/>
    <Policies>
      <ServicePackageResourceGovernancePolicy CpuCores="1"/>
      <ResourceGovernancePolicy CodePackageRef="CodeA1" CpuShares="512" MemoryInMB="1000" />
      <ResourceGovernancePolicy CodePackageRef="CodeA2" CpuShares="256" MemoryInMB="1000" />
    </Policies>
  </ServiceManifestImport>
</code>

Using Windows Jobs with Service Fabric


rounding float up $.01 in python

Question: I am working on a program that stores numbers as floats which I eventually write to a file as currency.  I am currently using the round() function to round it to 2 decimals, but the business area would like me to round to the next penny no matter what the third decimal is.  For example:
x = 39.142

In this case I am trying to get x to round up to 39.15.  Obviously when I do the round function I get 39.14...
>>> round(x, 2)
    39.14

Is there a way I can always round up to the next penny?  I should mention that the numbers I am dealing with are printed to the file as currency.
Comment: If it's currency, please don't work with floats. It's just asking for trouble. It can be done, of course, but it's more trouble than it's worth.
Comment: @LanceCollins: The answer that you have selected is grossly wrong. See my comments.
Answer: Using the decimal module:
import decimal
D = decimal.Decimal
cent = D('0.01')

x = D('39.142')
print(x.quantize(cent,rounding=decimal.ROUND_UP))
# 39.15

Decimals have many options for rounding. The options and their meanings can be found here.
Comment: +1 This should be the accepted answer. Tim's should be deleted.
Answer: if you want to write it in cents, you could use int(x*100+.5) to get cents integer from float dollars.
Answer: Very late to this, but in case anyone wants a simple one-liner in Python 3:
import math

x_rounded = math.ceil(x*100) / 100

rounding float up $.01 in python


Why does CACHE_TEMPORARY have the same value as DRUPAL_NO_CACHE

Question: I'm trying to change the cache of my block (hook_block_info_alter) but it seems if I change from CACHE_TEMPORARY to DRUPAL_NO_CACHE, it doesn't make a difference.
Drupal declared them like this:
define('CACHE_TEMPORARY', -1);
define('DRUPAL_NO_CACHE', -1);

Why do we have the same value if they're meant to be different?
How can I change the value in hook_block_info_alter?
Answer: They have different uses. CACHE_TEMPORARY and CACHE_PERMANENT are values that cache_set() accepts as its last parameter. DRUPAL_NO_CACHE is used from Drupal only for blocks.
Two variables are allowed to have the same value, and this doesn't create confusion, as long as they are used in different context.
While both the variables have the same value, you should not use them when appropriate, at least because it makes more difficult to upgrade your code to Drupal 8.
In hook_block_info_alter(), as with other hooks for blocks, you should use DRUPAL_NO_CACHE. Keep in mind how the data passed as first argument to the hook is structured. With $blocks['forum']['active']['cache'] = DRUPAL_NO_CACHE; used in hook_block_info_alter(), you would avoid the block showing the active forum posts is cached from Drupal.
Comment: Yes, -1 says the block should not be cached.
Comment: In the hook_block_contents of my module the cache is set to CACHE_TEMPORARY, and when I want to override it on hook_block_info_alter, it already has the "-1" value, does it mean it's already excluded from the cache?


How to apply 'Blink' feature in Ember Table?

Question: in Ember Table, I need to change style of a cell with the change of particular cell content.  I need to add color to cell with value update (that I have already done) and remove styles after 1 second (that I want to do).
I have called setTimeout when applying color and removed color within setTimeout. It does not work all the time. some cell colors are not removed.
(this gets worse when scrolling). I assume after 1 second, Ember cannot find the particular cell element.
I use and Ember table component and assigned a contentBinding and columnBinding.  I added a template for the Ember.Table.TableCell component and added class names.
Added Main Function and modified Jsbin example below.
Answer: I can't guarantee that this will answer your question, but here are a bunch of things that jump out at me when reading this code. I think they are best formatted as an "answer".

You should avoid side-effects, like calling setTimeout, within a computed property. Computed properties in Ember are lazy, so they only update when their value is needed. Consider using an Observer, or just a function, in cases like this. This is almost certainly related to your problem.
Instead of setTimeout, use Ember.run.later or similar Ember functions. This will make sure your code respects the Ember run loop.
Your customColor computed property doesn't depend on previousColumnValue, even though it uses it. This is related to the side-effects discussion: you should try to re-architect your code if possible.

Other than that, you have a lot of the right ideas. I'm fairly sure this can be done with Ember Table - the AJAX example is an example of Ember Table cells dealing with asynchrony.
I recommend debugging by first trying to create a minimal example in JS Bin, using the Ember Table starter kit. This will also be useful if you'd like more help - it makes it easy for people like me to play with your setup until it works.
Comment: i posted my example and new issues faced here. http://stackoverflow.com/questions/29071528/add-blink-feature-in-ember-table


How can I determine the optimal size of the maxThreads of my NIO/APR Connector for Tomcat?

Question: I am using NIO/APR Connector for Tomcat7.
E.g.
<code><Connector port="8080"
        protocol="org.apache.coyote.http11.Http11AprProtocol"
        connectionTimeout="3000"
        redirectPort="8443"
        URIEncoding="UTF-8"
        maxPostSize="0"
        maxThreads="200"
        enableLookups="false"
        disableUploadTimeout="false"
        maxKeepAliveRequests="-1"
        useBodyEncodingForURI="true"
        compression="on"
        compressableMimeType="text/html,text/xml,text/javascript,text/css,text/plain"
        />
</code>

How can I determine the optimal size of the maxThreads of my NIO/APR Connector for Tomcat?
What is a good starting value for maxThreads?
Answer: The OOTB configuration is typically 150 – 200 total accept threads for each connector. This default is intended for medium load / complexity applications on "average" hardware.
As a general rule of thumb, a lightweight, high performance application should look at using a maximum of 150 (accept) threads per CPU core (so a total of 600 on a 4 core box). A more conservative setting, for more heavyweight applications would be 300 accept threads. I'd expect most requirements to be somewhere around the middle (but this will need some analysis), but this is highly situational - see @zagrimsan's answer.
Obviously HTTPS has a slightly higher overhead, so the standard practice is to reduce the number of accept threads accordingly.
Using the APR / native connector can improve throughput, but the limiting factor is usually the application profile, so again, no magic numbers.
The danger of using a thread setting that is too high is that the server can become "terminally busy" – where so much time is spent managing threads and application demands, everything else suffers (GC being notably one symptom). It seems counter-intuitive, but generally less is more.
A busy server with the thread count correctly configured will degrade gracefully under heavy load. Too high and it'll fall over!
Now, there are a number of related settings (accept count, min threads, waiting etc.) that will also need adjusting to suit, but that's beyond the scope of this answer.
Answer: The answer depends on the load you're expecting to serve.
Quoting the accepted answer from a thread from StackOverflow which, even though it talks about a setup with Tomcat and Apache, applies here as well:

You should consider the workload the servers might get.
The most important factor might be the number of simultaneously
  connected clients at peak times. Try to determine it and tune your
  settings in a way where:

there are enough processing threads [...] that they don't need to spawn new threads when the server is heavily loaded
there are not way more processing threads in the servers than needed as they would waste resources.

[...]
For example consider an application where you have ~300 new
  requests/second. Each request requires on average 2.5 seconds to
  serve. It means that at any given time you have ~750 requests that
  need to be handled simultaneously. In this situation you probably want
  to tune your servers so that they have ~750 processing threads at
  startup and you might want to add something like ~1000 processing
  threads at maximum to handle extremely high loads.


How to compare and group an ArrayList Object

Question: I am trying to group an ArrayList of event into a list of dates but have no idea how to achieve it.
My goal is to load the grouped data into an ExpandableListView see image below.
I have a list of dates and a list of events too. So, I want to group the events objects into different days based on their date attributes.
Answer: You have to convert your data in the way ExpandableListAdapter wants them.
Android has SimpleExpandableListAdapter that can be used but this does not look even a little to the screen you provided. Just for reference here is an Example using such an adapter, so you get a point how it works.
If you want something exactly as the screen you provided you have to implement a custom expandable listiview with ExpandableListAdapter by extending BaseExpandableAdapter
In case the items under the dates does not expand-collapse by pressing then I strongly sugest to look for a ListView with Section Headers the implementations is much easier.


Is factor analysis appropriate for repertory grid data?

Question: I've used factor analysis for questionnaires and such before, but I have a new research question now and it doesn't seem like anything similar has been done. I've had participants rate 8 news articles on a variety of measures. However, each measure is provided by the participant themselves based on meaningful differences that they see between the articles. This is a repertory grid, where the elements (columns, variables) are different articles, and each participant provides a number of constructs (rows, cases) which they see as important (such as 'objectivity', 'persuasiveness', 'accessibility' and so on). Each article is rated on each construct which that participant provides, so my data looks something like:
<code>Subject    Construct         Art1    Art2    Art3
1          Objectivity       5       3       8
1          Persuasiveness    3       8       7
1          Accessibility     7       6       3
2          Formality         3       4       6
2          Factuality        8       2       6
2          Use of Sources    7       6       9
</code>
(and so on, with 8 articles and around 8 constructs per subject)
My aim is to find the latent variables that best describe the variance between the different constructs provided by my participants. So far, I've been under the impression that factor analysis is appropriate for this. With 8 articles and ~160 cases, I should be getting a couple of factors and their loadings on each article, as well as the factor scores from each construct that I can use for interpretation. But is this crazy? I know this isn't exactly what the method was designed for, but I'm not aware of any theoretical reason to be wary here. My initial analyses are throwing up low communalities and failures to converge, so I'm starting to suspect I may be using the wrong method (or I don't have enough data, but most of the commonly used criteria put me in the clear)
Should I be using something else, like cluster analysis or IRT models?
Comment: Look into [three-way component analysis](https://ppw.kuleuven.be/okp/_pdf/Kiers2001TWCAP.pdf)
Answer: As @jeremymiles pointed out the use of FA or its extensions to three-mode FA is only sensible when elements and constructs are supplied, thereby sacrificing the idiographic nature of the repgrid.
I would recommend  an alternative road that preserves the individual data while at the same time allowing to analyze aggregates and search for underlying latent factors: Procrustes Analysis. The method is commonly applied in the field of sensory research, where free choice profiling (FCP) yields a data structure with idiographic attributes across a set of objects, just like a repgrid. The PCP community (with a few exceptions) has been quite reluctant to adopt this method. There is a non-technical introduction to grids and procrustes analysis (Grice & Assad, 2009). The method of how to analyze the data and identify underlying factors is described for FCP data in many places (e.g. Arnold & Williams, 1986; Williams & Langron, 1984). For grids, procrustes analysis is implemented in James Grice's Idiogrid software which is freely available on Windows. An example of the output can be found here.

Arnold, G. M., & Williams, A. A. (1986). The use of generalised procrustes techniques in sensory analysis. In J. R. Piggott (Ed.), Statistical procedures in food research (pp. 233–254). London, New York: Elsevier.
Grice, J. W., & Assad, K. K. (2009). Generalized procrustes analysis: A tool for exploring aggregates and persons. Applied Multivariate Research, 13(1), 93–112.
Williams, A. A., & Langron, S. P. (1984). The use of free-choice profiling for the evaluation of commercial ports. Journal of the Science of Food and Agriculture, 35(5), 558–568. doi:10.1002/jsfa.2740350513
Answer: Principal components analysis (PCA; which is related to factor analysis, and sometimes found under the same menus in stats packages) is used to analyze repertory grids - but it tends to be one person's grid at a time. If the user generated the constructs, I don't think you can combine grids because the variables don't make sense over time.
Hierarchical cluster analysis (HCA) is also used, but again on an individual grid, not on multiple  combined grids.
This article http://onlinelibrary.wiley.com/doi/10.1348/014466501163652/pdf (which I don't think is behind a paywall) describes the use of PCA and HCA in the analysis of a single person's repertory grid before and after therapy.
With repertory grids you can give more or less 'starting' information to your respondents. You can have them generate elements, or you can generate elements - you generated the elements (the articles). Often you ask the respondent to generate elements so that they are meaningful (e.g. a person you liked; a person who rejected you). You can provide constructs, or you can ask the respondent to provide constructs - in your case, you asked the person to provide the constructs.  You can also vary the number of constructs that are generated - some respondents want to use more, some fewer (i don't think you did this.)
As you add more restrictions, you increase the comparability of the grids, but potentially decrease the usefulness.
You can only really combine and compare grids where you provide both elements and constructs, but most people would argue that you're not doing rep grids any more. Rep grids are (usually) considered to be a structured qualitative research tool - usually, you do the first stage of analysis on the grids - using something like PCA or HCA, and then you look at the results for emerging themes.


how to use create scrollable body with default tab bar in flutter?

Question: i want to create page using tab bar and also singlechildscrollview in flutter, and i still dont get any solution for it. i want to have an icon and text for tab description so i guess i cant use tabs.map as string only and here is my code. and i've been try to add refractor the body with singlechildscrollview and everything disappear
bottom: const TabBar(
              labelColor: Colors.blue, //<-- selected text color
              unselectedLabelColor: Colors.grey, //<-- Unselected text
              tabs: [
                Tab(
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: [
                      Icon(
                        Icons.mail,
                        // color: Colors.blue,
                      ),
                      SizedBox(
                        width: 5,
                      ),
                      Text(
                        "Inbox",
                        // style: TextStyle(color: Colors.blue, fontSize: 14),
                      )
                    ],
                  ),
                ),
                Tab(
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: [
                      Icon(
                        Icons.inbox,
                        // color: Colors.blue,
                      ),
                      SizedBox(
                        width: 5,
                      ),
                      Text(
                        "Disposisi",
                        style: TextStyle(
                          // color: Colors.blue,
                          fontSize: 14,
                        ),
                      )
                    ],
                  ),
                ),
              ],
            ),
          ),
          body: const TabBarView(
            children: [
              listBerita(),
              Icon(Icons.directions_transit),
            ],
          )),

enter image description here
i was expecting that my data that imported from listBerita() can be scrolled
Comment: Can you include sample data for `listBerita`
Comment: Can you try to wrap your returned widget with SingleChildScrollView of listBerita
Answer: return DefaultTabController(
  length: 2,
  child: Scaffold(
    appBar: AppBar(
      title: Text('Appbar'),
      bottom: const TabBar(
              labelColor: Colors.blue, //<-- selected text color
              unselectedLabelColor: Colors.grey, //<-- Unselected text
              tabs: [
                Tab(
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: [
                      Icon(
                        Icons.mail,
                        // color: Colors.blue,
                      ),
                      SizedBox(
                        width: 5,
                      ),
                      Text(
                        "Inbox",
                        // style: TextStyle(color: Colors.blue, fontSize: 14),
                      )
                    ],
                  ),
                ),
                Tab(
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: [
                      Icon(
                        Icons.inbox,
                        // color: Colors.blue,
                      ),
                      SizedBox(
                        width: 5,
                      ),
                      Text(
                        "Disposisi",
                        style: TextStyle(
                          // color: Colors.blue,
                          fontSize: 14,
                        ),
                      )
                    ],
                  ),
                ),
              ],
            ),
          ),
    body: TabBarView(
            children: [
              listBerita(),
              Icon(Icons.directions_transit),
            ],
          ),
  ),
);

Widget listBerita(){
  return ListView.builder(
          itemCount: 50,
          itemBuilder: (BuildContext context, int index) {
            return ListTile(
                leading: const Icon(Icons.list),
                title: Text("List item $index"));
          });
}