I’ve been watching Microsoft’s Build event, been doing so since last year and this year has been pretty darn exciting. I’ve yet to dabble into C# mostly due to most of my energy going to C++, it’s apparent that I want to work with C#, after working with Qt I feel like the reach for “easy mobile development” is a mere pipe dream. I feel… disappointed? I guess. The truth is that I’ve spent my time doing more workarounds and hack-ish solutions that actually working on my application. QML is a very, very insanely powerful language, the things it brings to the table is just awesome. Yet, the price to pay is having poor documentation on many QML elements.
Putting my feelings aside on Qt/QML for a moment. I think that I will eventually push for C#, in all honesty I just want to stay with one, maybe three languages to work with. Right now I’m just a jack of all trades, and I don’t like it that much.
Anyway! More updates
Recently I bought an SSD, a 256GB drive and it has been a huge step for me. I usually had to wait 5-9 minutes for a full boot in a normal HDD. Now it boots completely in 20-30 seconds.
I also bought off a 970 GTX from a friend. I’m way behind games, and well, hardware in general. Once I installed it on my PC it blew my mind after playing games like Witcher 2 in pure 60FPS, Call of Duty: Ghosts was the one that called my attention the most with insane level of detail. I plan to snatch Advanced Warfare eventually too.
Both hardware pieces have contributed greatly on my PC. The boot time is no longer a problem and Visual Studio opens in less than 10 second. Meanwhile games I had problem playing due to framerate issues are no longer an issue.
Now… there’s only one big worry I have. Software development interviews and getting hired. These are possibly my biggest challenge, as a person new to the industry I just don’t know what to expect.
It’s been an awful week for me, sort of like a roller coaster. Like two weeks ago I got the notice that I qualify for graduation, there’s only two courses left that I have to take, that is the internship (which isn’t much of a course) and a history course. Time has passed, year after year I just wanted to get that degree already so I can finally drop my applications to U.S-based companies.
Obviously programming is a very competitive field. I already admitted myself that I will make mistakes and that “I know that I know nothing”. I hope that all the time I spent studying, tinkering, practicing with different programming languages comes to fruit. I’m thrilled and terrified, really.
I’m finally there though, these past three years have been hard, painful, agonizing even on multiple levels, ranging from family issues to profession issues. That said, it’s no use of thinking of the past, it’ll get you nowhere. Usually I just severe anything in between and carry on, for the better or worse.
Just three months more. o/
I feel awful, yet happy, yet tired.
A bit of an annoyance is when you spend hours doing something, then a week or two later you see a new library that does that and simplifies the code greatly; allowing maintenance and readability at the same time.
So, take it as you may but if you are using classes like
QDomDocument do yourself a favor and try
pugixml library. It’s said to be faster than the previously mentioned. In terms of code readability
QDomDocument is the nearest that matches pugixml due to its DOM api, yet it’s also slower and consumes a hefty amount of memory in exchange, where as pugixml stays lean.
I’ve been working with HTML in low-level languages like C/C++ and I must say that it’s been a rather frustrating experience. One would think that the task I’m doing should have been done ages ago, since the conception of the project. Alas, that’s not quite right. What you fail to realize is that you should NEVER underestimate the dirtiness of HTML outputs all around the world. This whole week has been about cleaning/scrubbing/sanitizing HTML. I ended up grabbing to rather awesome third party libraries, one called
pugixml and the other
libtidy (also known as tidy-html5).
libtidy, being a pure C library took me a while to get the hang of as I’m not that experienced in C. Even though I’m writing C++ it doesn’t mean I’m working with pointers the majority of time (mostly on the stack). It was more of a game of “copy this chunk of memory and put it as an argument in this C++-powered method so I have more control over it with the classes I’ve built. But I needed it to work, regardless on how long it took to get right because without tidy it would be really, really hard to do any scrubbing. pugixml and other XML parsers can get quite cranky while parsing misplaced tags.
Which brings me to pugixml!
Apparently QtXml module is no longer maintained as it has reached a matured state. The array of classes QDomDocument have in general feels suiting to do the job, sadly the documentation stresses that it uses too much memory, and apparently “pugixml is faster than QXmlStreamReader”
In the end. I chose pugixml because it’s just simple, it doesn’t have the annoyances QXmlStreamReader brings.
Another subject I wanted to bring is the interest of the C language.
I’ve been thinking of learning more about C. At least the basics to defend myself from cases like libtidy. I also wanted to learn more about C due to Gtk3 and due to getting closer to system programming (not that C++ isn’t capable). Mix this interest with me wanting to work with microcomputers or embedded systems and I might make something out of it.
Lastly there’s that thought of me wanting to get a job related to my field. I might try to get a job remotely, well, time will tell. For now I’m too tired, mentally spent, yet as I finish this post I have a class to attend to in college. 🙁
I didn’t spend too much time on this issue, but as someone who knows the basics to intermediate in SQL it still caught me off-guard on how easy it is to have insanely slow query performances.
Take an innocent query like this. Once would think it has some sort of meta information stored already, but it doesn’t
where mytable2.id=mytable.id ) as count
What it does is that it will get all the columns in mytable and additionally it performs a
COUNT based on id in a subquery thus the result is the total count per ID.
It took 7662ms to perform the query on two tables that have 387, and 4,800+ rows respectively. That’s not acceptable in any way, putting that sort of query in production will make your customers leave eventually due to the slowness of the system.
I googled a bit on the issue and found that sqlite doesn’t store any meta or index. I went ahead and create an index based on the second table, as the first one already has an index (primary key).
I managed to trim those seconds to 240ms, which imho is pretty acceptable, yet makes me feel uneasy.
indexed by my_awesome_index
where mytable2.id=mytable.id ) as count
That’s all it took.
I’m still not completely satisfied with results like this, I will continue finding a way to trim those 200ms away to 20 or 50. I have an idea on how to do it but for now this will do.
If by any chance you click whatever github link related to my account I have to say that I’ve removed myself from Github and now use BitBucket as my go-to needs for “backing up” and collaborating. There’s also GitLab but I have found that their interface and site is so… so slow, compared to BitBucket.
Yesterday, one of the most beloved wrestlers in the WWE, Daniel Bryan, announced his retirement followed by one of the most passionate, honest goodbyes in the WWE. Daniel retired due to medical reasons he was set to the final slot yesterday in Raw followed by the WWE Network for an extended time.
It was heartbreaking.
I love wrestling, really do. Seeing one of the wrestlers you cheered for go down for whatever reason hurts to some extent. Today though, I was reflecting on some of his words, his interactions with his family, and so many other things that made question, “what am I doing?”.
My interactions with people hasn’t been the best; I feel like most of the time I have spent has been wasted. I’ve been ungrateful. I seldom smile honestly, it’s something that I have taught myself to do over the years. I want to learn how to “act” normal, while missing the point of being yourself.
I wish I could say I tried, but this isn’t the case. I have given up so many times without trying, yet you see this guy, Daniel? He’s a fighter, he kept pushing on even with all the injuries. I didn’t. I always come around, really late, pick myself up and push once again.
Which is why it was never a matter of “trying harder” but having the desire to want it. There’s a lot of issues I want to resolve… I guess time heals old wounds. I did learn a lot yesterday, I just don’t think I can put it into words.
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.
I guess I should start by saying that I’m using
PyQt4 mostly because… well, I don’t have an excuse, just pure laziness when I started writing the code. This is mostly an exercise where I toy with Python and Qt in general; I find it “relaxing” to work on other stuff than eating C++ every day, and Python being as delightful as it is I know I don’t have to worry about memory management at all.
So, in this little app I just wanted to play with slots/signals to see how it was done in PyQt. The documentation in PyQ is messy and that is an understatement, I had to poke a lot of pages in the documentation just to see how it was done. I’m not sure if PySide is any better …
Anyway here’s the code:
from PyQt4.QtGui import QSpacerItem, QApplication, QTextEdit, QPushButton, QWidget, QLabel, QVBoxLayout, QMainWindow
from PyQt4.QtCore import Qt, SIGNAL, pyqtSignal, pyqtSlot, QObject
app = QApplication(sys.argv)
window = QMainWindow()
widget = QWidget()
textEdit = QTextEdit(widget)
pushy = QPushButton("Say my name", widget)
spacer = QWidget()
label = QLabel("Type your name",widget)
label.setText("Hello, %s" % textEdit.toPlainText())
# _clicked_ is a signal from QPushButton. This form of connection doesn't
# get detected by YouCompleteMe in the autocomplete... so gotta read up documentation
layout = QVBoxLayout()
I find that if I’m going to invest a lot of my time with Qt. I think Qt/Python makes a devastating (awesome) team in the sense that whilst you don’t have to worry about memory management you can fully focus on writing and gushing out that vital code the business needs . I’d say that depending on the nature of the application Python/Qt will do on most cases. These days memory is cheap, hardware is more powerful than ever… nevertheless always know the nature of the app before choosing a language.
I concluded that hopefully in my next project I’ll be using that combination.