Posts

Finally switched to Linux Mint

After sticking with Ubuntu, I have switched to Linux Mint 17.

Distroshare Ubuntu Imager - Remastersys replacement

I have been Remastersys to backup my customized distros for what seems like years. Its been a wonderful utility nicely tailored for this task. But its development stopped few years back, and so there have been couple of alternatives for that. Just recently I had to put together an ISO of my current OS setup on one of my laptops. So digging around I stumbled upon distroshare utility. This is a nice replacement for Remastersys. Its actually called Distroshare Ubuntu Imager. After trying it out I found that it does exactly what I was looking for. And I successfully created a Live CD backup using distroshare.

TCP/IP Client server persistent connections

So just last week I was moved to another project where I'm gonna be working on a client server program. So we are going to be using TCP/IP for communication. And its exciting since its been over two years since I last dabbled in networking. Life is looking exciting. Anyway so the problem was everywhere I looked, I could find only simple networking examples. So I dug in and put together some code to keep a connection alive for back and forth connection. What I did was basically keep the connection open for next request rather than closing it and reopening it. This enabled me to have a continuous chat like communication between client and server. Then I spent some time refactoring the code to make it streamlined. But I still have to add error handling to it. I'll share it here when I have it ready. It was fun!!!

Limiting CPU percentage of a process

cpulimit is a utility available on Linux to limit the CPU time of any process. The use is cpulimit -l [℅ CPU] -e [binary name] I found it useful to emulate slow embedded processor behavior on desktop.

Qt Object Thread Affinity

Image
Example code: https://drive.google.com/file/d/0BxorjNRCBW61ZEJhaEJST1RZa0k/view?usp=sharing For last whole year I have been totally lost between threads, mutexes, shared data, pointers, signals and slots and blah blah blah. Actually I have learned a heck of lot about all these things in these few months. But I think I haven't grasped everything yet. There are many combinations that I don't know work or not. And I think there are many other tricks I am yet to learn especially when it comes to debugging. Anyway, this post is about QThread and object affinity. Well, the typical QThread example is way too simple. They show an object containing one worker function and that worker function running in that thread when they start the thread. Beyond that, nothing! What happens if you call any function on that object, what happens? What about concurrency? What about when the thread is busy? Will the slots get queued up? Lots and lots of questions. But the r...

sudo apt-get remove linux-image-3.13.0-4*

Image
*update: It worked!!! In a hurry to remove multiple old linux kernel versions from my system I popped in above command. After a while I came back to the terminal to find all my kernels were un-installed!!! :J Well, thankfully I noticed what has happened and right away reinstalled the latest one with this command: sudo apt-get install linux-image-3.13.0-62-generic. Haven't rebooted yet. Let see!

Qt global thread pool max thread count

Recently I encountered that some threads are not launching in our application using QConcurrentRun. If you launched the same worker function over QThread it was working.   So digging into this gave us this problem with defaults for Qt's global threadpool. Basically Qt sets global threadpool's max thread count to the no of cores you have on your processor. We were easily running out of the default four max threads. So we upped the count to 32 using following function:  QThreadPool::globalInstance()->setMaxThreadCount(32); We set this at start of the program in main. Things have been fine since then!