More than a feeling

Standard

Since my last post, that little social interaction group I had, has become a bit more tight. In this spirit of next level of acquaintanceship, we had an evening together. It was invigorating and more than a feeling. Good food, good company complimented by pleasant climate and an endless stream of human population in the crowded streets of Old Delhi. It was a good experience given the fact that I usually shun such bondings and interactive activities.

Father was a bit unwell and was under medical supervision. He was given a green signal today to carry on with life as he usually does whilst taking certain precautionary measures. It took sometime to get things done and get him back home. I wrote this because I wanted to give a reason for my late arrival to the venue for the evening. But anyway, I was present at the scene and thus started the evening of passing smiles and random sentences. Since all the participants are food lovers and Old Delhi is known for it’s delectable street food, we, being sincerely foodie and sidelining health concerns, went on a street food spree.

IMG_20160130_164808

In lieu of Indian Republic Day on 26th of January, Delhi Tourism has organised a food festival at the magnificent Red Fort. Various people from various states of India had on display and sale, various food items. Various states showcased their traditional art forms and specialities of their states in forms of tableaux and stage performances. It was a good atmosphere and I really enjoyed the positiveness of the moment. Lady D and Soni looking pretty as ever were making me skip a heart beat with every other smile that lingered on their lips. The Guy was, as always, in total tune with my frequencies and we had a laugh about many a thing. We have such social interactions at work too but the punch was the ambiance of the location.

groupie - 1

Chandni Chowk is especially known for this street called “Parathe Waali Gali” which roughly translates to “Baker Street”. Well, wtf to that. The crux of the evening was this restaurant which has a legacy almost 200 years old. The walk from Red Fort to this restaurant was long and in the overly crowded streets of Chandni Chowk, navigating your way through is an exhausting activity. The company was such and the euphoria of being with amicable humans, the walk didn’t put much strain on any muscle as such. Good, I usually avoid putting any strain on any muscle during weekends. All were chittering and the good thing about it was, none of it seemed exasperating. Given the fact that Lady D has naught capacity for bullshit, it was fun to say random stuff to her and listen to an equally random hooting from the ladies as a consequence.

IMG_20160130_172346

And coming to the heart of the street food spree, the parathas were decadent and savoury. The restaurant was established in 1875 and has been, since then, serving various kinds of parathas in an overly small shack located inside a more overly crowded street. It’s a shack yes… don’t let that fool you. The food there is worth all the money that you’ll shell out after stuffing yourself till you choke. We, being sincerely foodie and sidelining health concerns, satiated our craving for such delicacies. The Guy suggested the “banana paratha”. Its’ roughly equivalent to a croissant stuffed, generously, with pieces of bananas and cashew and cream. It was something I have never eaten and it was delicious as fuck amongst other things. The buttermilk or, in native tongue, Lassi was as authentic as a Lassi in this part of Delhi can get. They still use the same ingredients and methods going back almost 200 years.

IMG_20160130_174906041

A traditional Indian meal ends with a dessert and we, being sincerely foodie and sidelining health concerns, honoured this tradition. Falooda is a speciality of this area of Delhi and this place is the to-go point. Oh damn the sweetness. I have never kissed a female human but I think this falooda would be sweeter than that. The walk to that place was lengthy too but again, with the company, it was jovial and jocund. The falooda called to an end, this awesome evening, that is forever laid down here with these words.

Wishing that this level of acquaintanceship only grows upwards, I sign off with a special tip of my hat to the humans of this little social interaction group. Let’s keep this spirit of new level of acquaintanceship alive and kindle it to a newer and better level.

Ninja.

Advertisements

Panegyric

Standard

It means an expression/article of praise. Its’ been a while since I have updated my blog. I’m happy actually. Not that rainbows and butterfly kind of happy but life-is-going-good happy. I have a social circle and they talk to me too, which is nice. As per social conventions, you should say good things about people who have a positive impact on you. I have 4+1 elements in this set of human entities and in this panegyric I’ll try and describe these 4+1 elements.

At work, I have nothing much to do so I was working on Qt/QML. Qt is to C++ what Android is to Java. Like Android, Qt is not pure C++ and rather extends C++ and makes it more awesome (as if C++ needed to be any more awesome). QML is a declarative language that is used to design UIs and together with Qt, one can create powerful desktop applications independent of platform. A friend asked me for a comprehensive tutorial and I’ll try to elucidate a sample music player application I made in Qt/QML. It’s nothing much really but it does implement concepts of models, views, delegates and exposing variables from C++ code to QML. You can download the code here and must have the latest updated version of Qt Creator.

So I have 4+1 elements in this set of human entities. 4 of us are in a group and we talk on this messaging application where they laugh and respond or simply respond. The other element is whom this article is meant for. The Guy and I discuss not about piffling things such as human dealings (a.k.a bitching) and talk about better things such as world happenings and imaginative ideas that may not happen in real life. This one is rathe for new ideas, adventures and experiences and values friendship. This one thinks that I’m erudite so I assume that there is something wrong with this one. And as a matter of fact, there is. This one has his own world and is lost most of the time in that world. It would be condescending to say that The Guy should adjust the volume of his voice but its’ ok. At least he speaks not shit like most other humans do.

Sweet P is sweet. This one is happy go lucky and has an infectious smile. This one is artistic and sees a world full of colours and possibilities. This one also yearns for new experiences and has a lot to see and do. This one too thinks that I’m erudite so there must be something wrong with her too. And there is. This one is too happy. I wish that this one gets to see the fucked up side of life soon. One becomes a true sage when they experience downward spiral as zealously as upward spiral.

Open Qt Creator and start a new Qt Quick application. Like most languages today, it scaffolds a basic skeleton for your application. A “main.cpp” file and a “main.qml” file. The CPP file is the controller and QML is the application UI. I added a “player.h” file that defines a class for the music player and a “player.cpp” that defines the controller logic for the music player. If you run the application, it will show a menubar with buttons on the bottom and a “load area” on top. The “load area” is where the UI of the music player will be loaded on click. QML looks like CSS on steroids and if you have an understanding of CSS its’ easy to grasp QML quickly.

QML is used to define “elements” of a UI. Every element has an ID and we refer to an element by its ID. Qt Creator is called so because you can create a UI by dragging and dropping (and editing properties) an element in the Creator window. If you see my “main.qml” file, there is a Loader element. This is the “load area” and we can load an external QML directly into this load are with the Loader element. To make an element clickable, we define, within that element, a mouse area. Mouse area defines an “onClicked” signal which is used to define the function of the element if it is clicked.

Loader {
 id: contentLoader
 x: 1
 y: 0
 width: 1023
 height: 324
}
MouseArea {
 id: mouseArea2
 anchors.fill: parent
 onClicked: {
     contentLoader.source = "mediaPlayer.qml"
 }
}

The important and confusing part, like margins in CSS, are anchors. You must read about anchors yourself but it basically means how an element is positioned relative to its’ parent.

Coming to “mediaPlayer.qml”, it looks much the same as “main.qml”. The focus areas are “FolderListModel”, ListView and MediaPlayer. In QML and in general, data is cast into a model. Model is how your data is defined. In this case, we are going to access a folder pointed to by the “musicUrl” variable (we will come back to this). A Model is used by a View to format the data you’re accessing. In this case, we are formatting it in a List and hence the ListView. A View uses a delegate. A Delegate defines how each element in a data set is rendered. In our case, each song in our music folder is enclosed in a clickable rectangle. If you click on it, it will start playing that song. We are using QtMultimedia library to play songs and it defines a MediaPlayer element. You can check out the available parameters of MediaPlayer and QtMultimedia library in the links. Here, we update the “source” parameter of the MediaPlayer element when we click on a song shown in the list. The available parameters of MediaPlayer are used further down the code for example: mediaPlayer.metaData.title and mediaPlayer.metaData.author.

 FolderListModel {
   id: folderListModel
   folder: musicUrl // TODO: write C++ Controller. Done
   nameFilters: [qsTr("*.mp3")]
   showDirs: false
 }
 ListView {
   id: playList
   x: 9
   y: 8
   width: 261
   height: 308
   spacing: 5
   flickDeceleration: 1000
   model: folderListModel
   delegate: Rectangle {
     x: 23
     y: 21
     width: 234
     height: 56
     gradient: Gradient {
         GradientStop {
         position: 0
         color: "#ffffff"
     }
     GradientStop {
         position: 0.881
         color: "#ae5151"
     }
  }
 Text {
   id: song
   text: model.fileName
   anchors.fill: parent
   verticalAlignment: Text.AlignVCenter
   horizontalAlignment: Text.AlignHCenter
   font.pixelSize: 12
   wrapMode: Text.WordWrap
   MouseArea {
     anchors.fill: parent
     onClicked: {
         mediaPlayer.source = model.fileURL
     }
   }
  }
 }
}

The third element of the set of human entities is Soni. This one is our darling. We all revere this one and look up to this one. This one is quite mature and emotionally and mentally stable. This one seldom thinks that I’m erudite so there is not much wrong with her. This one is a bit haughty and I feel lucky that I’m in talking terms with this one. Lucky because she is sorted enough to filter out obtuse humans out of her life. This one has experienced much and knows how to hold her composure and stature in direst of situations. This one is the coolest human entity I have come across till now. Right now, this one is globetrotting.

Yanka is not in the messaging group but the technical aspect of this article is meant for this one. This one is one hap chick. This one has a flamboyant style statement. This one is amiable and if you ask this one for some time, she will give you time. This one will sit and listen to you and talk to you. Although this one speaks almost 100 words within a minute but you can slow it down and process it mentally if you aren’t distracted by that sparkling smile. This one thinks that I’m intelligent but I give her that… not her fault, this one doesn’t know me much. Which is good for this one’s mental well being.

Lady D. This one is awesome. This one thinks I’m a fucking idiot and hence there is nothing wrong with this one. This one is different. Out of the pack. I can relate with this one and I like to think that this one and I have same mental frequencies. This one is funny, intelligent… pretty. A whole package just to take your breath away. This one is a bit narcissistic but that’s alright. It suits this one’s persona. You can sit with this one and observe her without getting involved and you won’t be bored. This one has an active (if not over active) mind and cannot sit still. I find many a similarity between this one and myself. I’m mentally (over) active and cannot sit still either. This one is striving to be mentally and emotionally stable like Soni and will eventually get there. This one has naught capacity for bullshit. This one forms clear opinions and characterises deliberately and clinically which I find utterly cool. This one thinks that she is all been there and done that but the only experience that she has is of that one city which was her first home away from home. Given all her imperfections though, this one is perfect in every way. If I ever decide to take a chance with some human, this one would be the one.

Coming to the “player.h” file, here we define a class that will eventually help us get the songs out of our directory and into the list model. In Qt, every class must extend the QObject class. I won’t go into the nitty gritty pieces of this class and directly jump to the implementation of the function definitions. QStandardPaths define all the standard paths in the OS for example, all the paths in the $PATH variable in a terminal are defined in this header file. In “player.cpp”, we extract the standard path to our music folder in the constructor of class “player”.

player::player(QObject *parent) : QObject(parent)
{
     musicPaths = QStandardPaths::standardLocations(QStandardPaths::MusicLocation);
     musicUrl = QUrl::fromLocalFile(musicPaths.isEmpty() ? QDir::homePath() : musicPaths.first());
}

The musicUrl variable is set in the controller as shown above. We must expose this variable somehow to QML so that it is accessible in QML. To do this, we add this variable to the root context of the main application engine.

engine.rootContext()->setContextProperty(QStringLiteral("musicUrl"), p.getMusicUrl());

This piece of wonder basically allows us to execute a function defined in our controller whenever the said variable is referred to in the QML. This is pretty fucking cool.

Well, this panegyric comes to an end. These 4+1 elements of this set of human entities are awesome. All opinions presented here are a solely the authors perspective. It is not the author’s intention to degrade anybody but if you feel degraded, feel free to take out time and jump off of a cliff.

Yours truly,
Ninja.