Aftermath of memory management / designing for mobile / the need of something better

The aftermath… of all my chasing is that I got nothing. You heard me right. I spent days figuring out what was wrong just to receive one hell of a slap to the face that the OS doesn’t necessarily claim the memory back. But, I also noticed that memory started to be freed after changing the parent of QNetworkReply to 0, meaning I manage it manually.

Regardless, after some testing I’m happy to say that while I messed up big time the application is working as expected. I think the lowest I saw was the app using 18mb and that for me is more than enough.


Now onto designing mobile applications. See, I’m not a designer I know that, you know that. I don’t think I will get this right… but it’s time to let go honestly; I have spent too much time trying to have the “perfect” design and such thing doesn’t exists. Now I will sit one more time to work on a new mock up.


Perhaps I’m losing my mind. The more I think about it the more I notice that I’ve been preventing myself from experiencing something good. Not so long ago I pondered on getting a Macbook Pro for various reasons. The first being development, the second being Unix, the third being a polished desktop, the fourth being an stable desktop.

I get it, you love linux and I do too. It’s not enough. I want better printer support, better wireless support, better battery life because Linux can’t even do battery life management correctly and for a battery that last 2-3 hours using Windows I get only 1 hour. I just want a better desktop experience. See, windows provide that without me having to do much. Linux… provides that to a certain degree, once things start breaking apart due to upgrades then good luck because you will need it depending on the issue. The whole “well, you can just reinstall it back’ isn’t even a solution but a living proof that linux is still behind desktop experience.

It feels awful though, being a supporter and all, but once you start luring people in and seeing them running into problems it just feels all kinds of wrong.

Looking back: OpenSUSE 42.1 with latest KDE packages

I’ve been killing some time with other Linux distributions. As far as I can tell one of my favorite Desktop Environments is still struggling out there. plasmashell crashes everywhere, right now the right side of the panel is a mess with icons overlapping on each other. It makes me a sad penguin!

I think… in 2015 I just stopped caring about the current progress of KDE… as much as it hurts to say. Amusingly–for some–I’m looking forward to see the next iteration of elementary OS or maybe Linux Mint Cinnamon. The next iteration of Ubuntu LTS is around the corner needless to say, so I’m guessing that both elementary OS and Linux Mint will be ready when the time comes.

I am looking forward to that at least. I am glad that I chose to test over in a virtual box before installing this on my laptop, else I would have been pretty upset.

As for OpenSUSE 42.1 (Leap) I got no complains whatsoever. It seems relatively stable, excluding the KDE problem as that’s a problem that lies with upstream, not OpenSUSE team. I got Spotify working in less than 10 minutes, sufficed to say I’m impressed on that since last time I had to hop through a lot of obstacles just to get it working.

Well, I hope 2016 is a fruitful one for Linux users. I also hope that KDE finally stabilizes this year.

The weird case of foreign languages

I have noticed over the months I have been working on my app that managing foreign languages like Japanese, Chinese, Korean, etc takes a memory hit to the point that it spikes up the memory usage–as one would expect. Sure, I expect more memory usage… but we are talking about a spike from 60mb (normal usage) to 80-100mb usage per entry–thus I was forced to call garbage collector manually as I couldn’t wait for the QML/JavaScript engine to do the clean up when there’s “inactivity”.

So, I was worried and added initial linux support to my app (never been planned to be released under linux) and found out that languages such as Japanese walks a fine line of 40mb memory usage. The garbage collector works twice as fast as well. For example, in Windows I’d call garbage collector and it doesn’t do it that fast. In linux? Blazing fast. It’s not much about the speedness of how fast it takes to free the memory, it’s the usage. I’m talking that Windows still takes 60-80mb+ (and up) while the linux build keeps walking the 40-50mb line.

Now, initially I suspected a memory leak, but that wasn’t the case. The Windows build just takes that much memory, and it worries me. Part of what keeps me at ease is that since this will be an android application; I can expect the same behavior that I get here in my linux mint in Android. Memory will be freed and the usage will be kept at minimum.

Granted: Pure naked eye seeing memory usage is not enough to suggest there’s a memory leak or that there’s a memory mismanagement, that’s the job of a profiler After running valgrind a few times I couldn’t find any memory leak just petty warnings, so I proceeded to guard against it, well, it wasn’t much about guarding as I honestly needed to free the objects that are no longer needed after X time. Plus, I also rationalized the usage that Windows is just being Windows… maybe Qt is pulling something that requires big allocations in Windows, but not in Linux for whatever reason. I do think that it has something to do with the font mechanism in general… but who knows at this point.

Spotting a minty taste

My family threw a party, but due to age, and humidity’s tag team partner, dust, it has decimated a lot of the music CDs over time. Plus my family track of music hasn’t been updated for decades so I was at my wits end since I refused to be exposed to more christmas music… seriously over the year it just…. gets unbearable, to know I have the potential to be grinch, huh.

Well, I came with the idea of connecting my Linux Mint powered laptop to the audio system but I didn’t have the cables to do so either. Luckily there was a stereo jack to 2RCA cable in my room–that I didn’t even know about–so basically the result became this:

mintyspot

Linux Mint, being a derivative of Ubuntu LTS release, I didn’t have to follow my own guide of fixing Spotify in Ubuntu Vivid… which makes me wonder if Spotify finally fixed their build. I’m a happy Spotify user, and I’d like to use the client in linux, not the weird web interface. Heck, you know, you might as well release the web client for linux.

I’ll elaborate:

I installed Fastmail’s Android application to access my mail weeks ago, and I noticed that their client is actually the web application embedded with a browser so all it does is API calls to the main servers and store whatever offline data it needs to.

It’s an option, only if providing the client to linux is hard for them. [avoid ranting about mostly clueless users who think cross-platforming is easy] (it’s almost a taboo to rant about users, it seems. Well, mostly counterproductive.)

In conclusion, Spotify is incredibly awesome. I’ve discovered a lot of artists thanks to it. Recently I have found that their Discover section is getting better and better, meaning we get to discover even more musicians that might be your cup of tea. There is a need for applications/services like Spotify for linux. Especially to premium users, we can sync our playlists and keep programming without a worry, or maybe sync music to your phone and go to exercise.

Reading list of 2016-01-07

Hello,

I thought I would start sharing some articles where I have found them to be insightful, thought-provoking, maybe controversial or funny. Don’t mistake “reading list” as “book reading list” that is! I do have some books in my to read list. 🙁

I read plenty of articles from Vox and other news sources on a daily basis, so here’s this week links.

I went on vacation alone. Why do people think that means I’m disturbed? by Catherine Andrews

This is the most common response — so common it seems to be mostly automatic. You’ll be chitchatting with somebody and mention that you’re taking off to the beach for a few days. Out of politeness they’ll ask who you’re going with, and you’ll tell them, “Just me!” Then it happens. Their eyes skitter everywhere. “Oh … wow … that’s so … cool!” they say — when in reality every twitching facial muscle is shouting, “Yeah, you definitely need to go on vacation. To a mental asylum. Why, oh, God, why would you ever go anywhere by yourself? You could get murdered! Worse, you might be bored! And you definitely are going to have to spend an extended amount of time alone with your thoughts — a fate worse than the random serial killer you’re sure to come across.”

Pretty darn on point. I’ve gone to the theaters alone and people look at me rather puzzled by it. Catherine really nails it down:

There can be a paralyzing sense of shame about doing activities alone that we’ve been told by society should be done with others — a shame that results from the assumption that anybody who sees you doing these things alone is judging or pitying you.

Which holds true in today’s society. As a person who enjoys doing plenty of activities alone I really recommend giving it a try.

Here’s Marvel’s new teaser trailer for Daredevil season 2 by Alex Abad-Santos

I have a little secret… well, not much of a secret. I didn’t enjoy Daredevil that much as many others have. I’m willing to give it a second run when the next season starts. That said, I’m looking forward to House of Cards new season.

I lost 100 pounds in a year. My “weight loss secret” is really dumb. by Alasdair Wilkins

(interestingly the article was written in the July 7, 2015 but somehow ended up in my feed reader in January… I guess the bump is real? Nevertheless, a great article)

The Hateful Eight, Quentin Tarantino’s new film, is a deeply interesting failure by Todd VanDerWerff

You know, this is an interesting time to release a film that many–who I dare say consciously practices political correctness as a lifestyle–find offensive, repulsive, or both. I didn’t particularly found the film to be thought-provoking, neither did I find it good or bad. I love Tarantino’s storytelling most of the time but in terms of plot it’s just a bag of mixed feelings altogether. Either way, I wasn’t offended nor disgusted… I do I agree with Todd VanDerWerff:

Pay attention to how the story works, though, and you’ll find that Daisy is granted almost no backstory beyond the bare minimum needed to set (or keep) the plot in motion. We know she’s a murderer — there’s at least a semi-convincing warrant for her arrest — but we don’t know anything about which murders she committed or why there’s a $10,000 bounty on her head.

While I don’t agree on the whole “society treatment of women” line (mostly because it’s far-fetched, and because Daisy is practically the only female that’s alive (not considering the three women Daisy’s gang members killed to get her out @ Minnie’s mostly because there wasn’t a modicum of development in any of them); the film is truly messy in terms of conveying the message to the audience. Personally, I was just indifferent to any of the characters in terms of connection or feeling anything for them as most of their conflicts were too brief, and to know it was just 3 hours long.

Delving into Qt Quick/QML, states and transitions

My apologies if the video is a big too long in terms of height. I’ve been working really hard to get my app out there, yet the more I move closer to my goals the more there is to do. I’m not sad about that though, if anything this has been one hell of a productive week.

C++/QML interaction

I feel like I should start talking about the interactions between Qt Quick/QML types with your C++ backend. I must say that I’ve had the wrong idea since the beginning. Why? Well, if you must ask I will tell you a nightmare prone story where my entry CPP file began with searching QObjects from the QML engine to establish a connection between my backend and the visual aspect(types) of my app.

At first sight it doesn’t sound bad, but it is. When you use QtQuick/QML (referred from here on as QML) the main idea is to provide a rich dynamic interface and have it all typed up with almost no effort. Yet, one of the questions you always ask yourself is “how to interact with the backend” and in the documentation it explicitly starts talking about finding children in the QML engine root object so you can connect them with your backend.

Depending on the type of your app there’s one huge problem: What if my app is too dynamic and the types/elements of it are always getting destroyed and recreated due to wanting to free memory?

The answer lies within either making the root object a hub of communication OR extending QML with new providers type. If you have read the documentation at some point you will come across an example that starts with creating a QML Type called Message and that message will provide and contain said message through its usage. After you are done designing the properties and members of Message object in your CPP backend you can register it with qmlRegisterType. A bit more info here, to those who are interested.

States

I have found that I have more control making my qml types have states or certain properties that hints the internals of my app of when to do certain things. States in QML helps a lot in that, while it’s commonly used in transition I can also see it as a semaphore to control the flow of how you want to direct the user.

As you saw in the video at the start of this post you can see I’m also using states.

Nothing is certain

Right now there’s just no right way to write your qml files. There’s no “best practices” excluding the memory management part in the documentation as it’s exclusively for memory management. How you lay out the visual objects and how you communicate and bridge it with your backend is up to you. I don’t really know if this is really good or bad, you just have to come up with an “efficient” way of not compromising the performance of your app.

All in all, it’s been a pretty nice experience. I just wish the documentation improved.

DuckDuckGo, you still need better search results.

Recently I’ve been a bit annoyed by the search results DuckDuckGo provides. I ended up switching to another search engine that’s quite underrated called StartPage. The results from StartPage comes from Google, sadly. I say sadly due to one major problem, most search engines sucks and that itself is a big issue as Google is a monopoly itself when it comes to search engine territory.

StartPage is better, however, it’s just a short-term solution to a bigger problem.

Then there’s Bing.com. My mission is to decentralize what I do, what I write, what I receive. Break yourself free from Google services by decentralizing Search, Mail, and other services (such as Google Docs, although Office online is a beast). The options are out there, you just need to adapt.

I should reiterate how awesome FastMail is, love its interface!

What I’d like to see in static generators

If you are

  • a blog addict
  • a web developer
  • someone who keeps up with recent trends

Then by now you should know about these things called static generators. In a nutshell, a static generator is a often small application that will render a document written in Markdown, Textile, or other type of markup syntax, create a whole HTML out of a designed template (or theme) and with the generated output you can upload it straight to your site.

Sounds very easy, right? Most static generators don’t have databases and most of them are platform-independent making it easier for the user to write his/her documents with ease and generate the HTML whenever the possibility is given.

Static generators, imho, have one of the biggest pros right now is that they don’t rely on any interpreter to gush out the HTML, meaning it doesn’t need PHP, Python, Java in the server-side.

There’s one thing that the static generators fail and that is providing a sane user interface. Ghost has gotten “good” with it, and by good is that they haven’t made any progress to go against an interface like WordPress, or any other easy-to-use CMS, blog software, etc.

They all lack in the user interface/usability department

At first I thought “hey, maybe Ghost is really gonna be that WordPress killer we have been waiting so far”. Sadly it turns out that even their template system is pretty primitive. I personally created a theme for Ghost, most of it was pretty straightforward but there wasn’t really anything that screamed “flexible”.

Beyond Ghost I don’t know any other contender that has actually tried to make an impact by being a static generator with a human user interface. Most static generators are written in a way that requires command line interaction to please the neckbeards, a few nerds here and there; that alone already disqualify it from being usable by the average user.

Which brings me to…

A question I have to ask is “What if the blogger is so active he/she can gush out over 400-800 articles within a year?” Taking in consideration how long X generator takes to generate an output of a large amount of articles written… any small tweak to the structure of the theme means the person has to reupload everything from scratch, in which dynamic solutions have the upper hand without a doubt. (a lot of variables varies here)

Bugs, bugs everywhere!

You know one of the most excruciating experience is when you are new to something the first thoughts you will have after analyzing an specification is:

  • Ok, I got this. All I need is this, this and that.

In web development, to me, it became something like that. I already knew what to do, how to do it and how to put the pieces together. Now with C++/Qt everyday is a challenge. Most stems from the lack of familiarization of Qt Framework API, and C++ standard library. Everything is so alien, yet so exciting at the same time, and so, so exhausting since you burn yourself a bit in the process.

Sometimes I like to take some time off and explore other languages, other frameworks/platforms. Recently I’ve found a need to learn C# and Visual C++ ^^. I will eventually learn them, my struggle begins with designing the application… and I’m guilty of over-complicating this task. Why? I have to keep repeating “we can always refactor it later”.

I guess, I’m just overwhelmed by all these things. I have worked and invested so much time, sometimes I have to wonder if it’ll be enough to get hired in a decent software development workshop. Hopefully next year I’ll find out after I graduate, but for now I must keep learning as much as I can and put my knowledge in practice.

As for my app? Decent progress, I’ve done a lot of bug fixes mostly related to the XML parser as for some reason Qt’s XML stream parser can drive you nuts. There’s still a lot to do, yet, the backend is more or less shaping up to be stable enough and the data from the parser has been inserting with no problems, meaning once I get the backend stabilized all I have to do is finish the frontend then the testing begins.

The alternatives I chose

This week have been pretty nice so far. As I keep educating myself in things the regards privacy I started developing my app, well, resuming development of my app. I got to the point that the decisions so far are sound.

The technologies/services I chose to replace of what I used to use so far…

  • Sync.com over Dropbox (note, it has a referrer tag. Nothing will happen if you click the link, it will just earn me free space just like Dropbox)
  • FastMail over Gmail
  • Chromium over Google Chrome. I should note that you can indeed get Chromium for Windows. You have to install PepperFlash (easy peasy) for flash support. Go get it!
  • DuckDuckGo over Google

In terms of applications I’ve more or less stayed the same. If it wasn’t for friends and family I would have chosen to get rid of Skype. I think I have taken care of the most crucial parts.