2012-09-07

Some thoughts on my philosophy concerning forums


Yeah, this is the editorial section.  Gotta go there some times.

There are far too many forum "gurus" and trolls who have an absolutely TERRIBLE attitude and it shows in the way that they "answer" forum inquiries.  You all know what I am talking about.  Short smart ass replies that say something like, "if you read the documentation...insert annoying tone and useless high level jargon, indecipherable to anyone who doesn't ALREADY know the answer to the posed question bla bla stop bothering me...".  Yes, we all now that guy.  Lots of those guys.

Here is a simple parallel metaphor to explain my philosophy on documentation and the attitude everyone should have if they participate in any capacity in forums:

You can only ever see a movie, for the first time, once. That is why the director has groups come in and view the movie before he puts it out, so that he can get a perspective on how it actually plays to fresh minds, as opposed to the inevitably warped version that will reach his mind after being filtered through all of his knowledge of what he wants the film to be and of what he already has seen countless times while editing. For film directors, this struggle to make something fresh and digestible, even though it is many years old to themselves, is right in front of them at all times. It is obvious. Once you know everything it is difficult to understand what is the needed amount of information to keep the viewer in touch with the narrative of the story and, for instance, what is going on in the heads of the characters at any given moment.  Is this amount enough?  Or am I making assumptions based on my overall knowledge of the complete character including aspects that have not yet been revealed.  A GOOD director is constantly worried about making sure that his message is getting across right now to people BRAND NEW to his story.  Not so much for programmers and IT guys. What do they care about noobs? Noobs should study more, right?

 I disagree. Study is what you do AFTER you are presented with a concept, in order to make it stick in your mind. It is still the job of the teacher, or the documentation, to present that concept clearly and unmistakably and taking into account all the common pitfalls. There is plenty enough gold to be had after the student has been lead to the mine, provided with a pick, and taught how to use it. Uh oh mixed metaphor!

It is wise to always remember that what appears easy to you, may have been easy for you simply because you got lucky enough to come at it from an advantageous angle, or because you had a good teacher, or because you got lucky and did it right the first time, while others may be struggling with shaking off terribly explained paradigms from the last intolerant asshole forum guru that gave them bad "advice" by giving them incomplete information.  If you get lost on the way to going somewhere every time you go there and all of the directions you ask for are wrong, then it is likely you will not remember exactly how to get back there the next time you try again.  Too many confusing memories.

So, if you are a forum guru, your abrupt, short, impatient answers may actually be helping to create more confusion, instead of helping, and guess what, it will come back to haunt you in the form of more "stupid" questions.  Yup, there is a good chance that you, or some other cocky, incomplete answer giver in a related thread, are the entire reason why this questioner is so stumped to begin with.  So just answer the stupid questions already.  Frankly, I see more stupid answers than stupid questions.  You cannot assume that someone is lazy just because they ask a question.  Sometimes frustration and overload make simple, basic concepts slip through the cracks.  Sometimes, dealing with a steady stream of flippant asshole forum "gurus" will just plain unbalance the chemical balance in one's brain!  However, from the answer side, if you KNOW the answer and you just flip a tidbit at them without clearly explaining, then you are truly giving a stupid answer.  If you are picturing yourself as Mr. Miyagi, and think that you are somehow imparting wisdom by being mysterious, then you are, again, an idiot.  You are not in an intense training montage from a Hong Kong kung-fu movie, you are answering a technical question in a forum specifically dedicated to that discipline.

Smart answers give clear concise information.  You knew that when you answered questions in school, right?  So what is the problem?  Real people not good enough for your A-game answers?  It baffles me.  Posting something like "I think it is clearly spelled out in the documentation", is a waste of every one's time.  It is the equivalent of answering a school test question with "that is defined quite well in the dictionary".  Imagine actually putting that on a test.  You would obviously get an "F" for that answer.  I am giving you an "F" right now for your incomplete, and/or smug, answer in the forums.  Put up or shut up.

The future belongs to the noobs!    They can be your allies, or your enemies.  You decide.  If you don't believe that it is safe to assume that anyone who is asking a question is trying to learn, then you should not be answering questions in a forum.  Go code by yourself in the dark and play some more WoW.

Cheers!

ultramanjones

2012-09-06

Property Animation in QML

It has been a long time since I put up a post, I'll try to post more often.  I'm posting up some code I wrote to make a button pulse after clicked and then quit pulsing when clicked again.  Simple, but it contains some important examples of syntax and implementation.  I hope somebody finds it useful.  
Start up QtCreator and select File/New File or Project.../Applications/QtQuick Application (Built-in Elements).  Enter a name and then select only Desktop.  Will it work on the other platforms?  Probably, but I haven't tested it on any but Desktop, so that is why I'm suggesting you do the same.  Just copy and paste this code over the main.qml and it should run.


import QtQuick 1.0

Rectangle {
    width: 400
    height: 400

    Rectangle {
        id: applyButton

        width: 100
        height: 30
        border.color: "#4f78a2"
        border.width: 2
        radius: 5
        smooth: true
        anchors.centerIn: parent
        color: "#BFEFFF"
        opacity: 1.0

        Text {
            id:textItem
            anchors.centerIn: parent
            font.pointSize: 12
            font.family: "Helvetica"
            color: "#337777"
            styleColor: "#ffffff"
            style: Text.Raised

            text: "Apply"
        }

        PropertyAnimation {
            id: changeToColor1;
            target: applyButton;
            properties: "color";
            to: "#ffff00";
            duration: 1000
        }

        PropertyAnimation {
            id: changeToColor2;
            target: applyButton;
            properties: "color";
            to: "#BFEFFF";
            duration: 1000
        }

        NumberAnimation {
            id: toFullOpacity
            target: applyButton
            properties: "opacity"
            to: 1
            duration: 250
            exclude: border
        }

        SequentialAnimation {
            id: sequentialOpacity
            running: false

            NumberAnimation {
                id: animateOpacity
                target: applyButton
                properties: "opacity"
                from: .2
                to: 1
                duration: 700
                easing {type: Easing.InOutQuad; }
                exclude: border
            }
            NumberAnimation {
                id: animateOpacity2
                target: applyButton
                properties: "opacity"
                to: .2
                from: 1
                duration: 700
                easing {type: Easing.InOutQuad;}
                exclude: border
            }
            loops: Animation.Infinite
        }

        MouseArea {
            id: applyButtonMA
            anchors.fill: parent
            //hoverEnabled: true
            onClicked: {
                if (sequentialOpacity.running == true)
                {
                    sequentialOpacity.stop()
                    toFullOpacity.start()
                    changeToColor2.start()
                }
                else
                {
                    changeToColor1.start()
                    sequentialOpacity.start()
                }
            }
        }
    }
}

                                         



When you click the button the first time, it will turn to yellow and start to pulse ( the opacity will cycle from 1.0 to 0.1 and back again over and over ).

When you click it again, it will return to it's initial state as a light blue button.  

I really love how you just put an id on an item and then you can refer to it later by that id.  Like:
   sequentialOpacity.stop()

It's quick object notation.  Since sequentialOpacity (my name) is an instance of SequentialAnimation I can use dot notation to access any of SequentialAnimation's functions.

QML is not exactly the "plain english" language that it appears to be.  Even the syntax can get a bit wonky at times and leave me scratching my head as to WHY is this element in this syntax, while all the rest are written a different way.  For example, take this bit of code from above:


            NumberAnimation {
                id: animateOpacity2
                target: applyButton
                properties: "opacity"
                to: .2
                from: 1
                duration: 700
                easing {type: Easing.InOutQuad;}
                exclude: border
            }
Apparently "easing" is an object? All the other properties use the colon notation, but then easing pops in using the syntax of an entire object. It could have been written like this:

 
            NumberAnimation {
                id: animateOpacity2
                target: applyButton
                properties: "opacity"
                to: .2
                from: 1
                duration: 700
                easing {
                   type: Easing.InOutQuad;
                }
                exclude: border
            }
Thinking of easing as a property had me coding with the wrong syntax for a while, and the error messages are not always specific enough to lead to proper correction. Eventually I ran into just one example on the inter-webs with the proper syntax and I fixed it, but it took some digging and sleuthing, and this sort of thing is a serious waste of valuable time.

"exclude: border" does not work either, by the way. I have no idea why. And QtCreator rejected entirely "exclude: border.color". Gave up on that one.

 Anyway, play with this and see if it helps you understand QML a little better. Let me know if you have any suggestions or questions. I've been working with QML for a couple of months now, and I've learned how to do a few things. If you are learning this powerful language ( and possibly Qt alongside of it as well ) then you have probably found that documentation of some of the simplest things is hard to find. I'm one who believes that documentation needs to include comprehensive examples, definitions and references to relative terms if it dares call itself documentation. As "extensive" as the Qt and QML documentation is, it lacks terribly in explanations, clarifications of concepts, and easy to read specific examples. IF you already know what you are doing, then it is an adequate reference, but even then I often run into dead ends.

Here are some more of my thoughts on that whole situation...

Thanks for reading.

 CHEERS! ultramanjones