Robert Basic's blog

Archive for the 'Blablabla' category

XFCE4 desktop zooming with the keyboard

by Robert Basic on January 19, 2017.

XFCE4 has a zoom feature available when the desktop composition is turned on. By default, holding the Alt key and scrolling up or down the mouse wheel, I can zoom in or out the entire desktop. Once zoomed in, it follows the mouse pointer as to which part of the desktop to show.

I prefer doing as much as possible from my keyboard, and to use the mouse only when necessary.

I don’t care much for desktop composition, the transparent windows and animations are not my thing.

Toggle desktop composition

Given that desktop composition is required for the zooming feature, I want it enabled only when I want to use the zoom feature itself.

Using the following command, I can toggle the composition on and off:

xfconf-query --channel=xfwm4 --property=/general/use_compositing --type=bool --toggle

xdotool to fake the mouse

xdotool is a nice little program that fakes keyboard and mouse input, among other things.

Using that, running the following command from the terminal, zooms in:

xdotool keydown Alt click 4 keyup Alt

and this command zooms out:

xdotool keydown Alt click 5 keyup Alt

Just to make all this even easier, I put these commands in a couple of bash scripts and added them as keyboard shortcuts.

Now I have Super C to toggle the desktop composition, Alt + to zoom in and Alt - to zoom out.

Happy hackin’!

Tags: accessibility, compositing, desktop, keyboard, mouse, xfce4, zoom.
Categories: Blablabla, Software.

Things I learned in the past four years

by Robert Basic on December 30, 2016.

Since yesterday was my last day on a project after four years and two months, I decided to take a look back on those four years and write down some of the things I learned.

Things I learned about being a better listener, a better communicator, a better team mate, a better programmer.

Leave your ego at the door

This is probably one of the hardest and most important lessons I learned. I’m happy that I learned it early into the project.

Ego gets into the way of the actual programming. There is no place for it. People get defensive about their code, become deaf to advice, don’t take criticism well. This slows down the development process, makes communicating difficult, if not impossible.

Criticism of my code is not criticism of me. If I submit a pull request and the reviewer deems the code not fit for inclusion into the project, there is nothing to get upset about. The code needs improvement. If I know how, I’ll improve it, if not, I’ll ask for help how. It is much better and efficient than getting all protective about the code.

Don’t play the blame game

Joe wrote an excellent piece on the blame game more than 3 years ago.

Removing the blame from the entire process is liberating. When dealing with a problem, don’t focus on trying to find the person, or persons, responsible for the issue at hand, but try to understand what caused the problem, what is the best and fastest way to solve it, and how to prevent it from happening again in the future.

I know I was lucky to be working on a project where this blame game was not being played and that there are a lot of teams and companies where there’s a ton of office politics and everyone wants to survive… But that stuff really isn’t helping any one. If possible, at least try to not play it within your team, with your closest coworkers.

Take responsibility

Admitting to a mistake is hard. It’s scary.

Admitting first to myself that I’m not infallible, that mistakes happen makes taking responsibility a lot easier. And it becomes easier over time.

I believe that people tend to react positively to sincerity. Being honest and upfront that I made a mistake, saying sorry, goes a long way. Yes, the mistake might have repercussions, but I’m an adult and I stand by what I did.

Taking responsibility is the professional thing to do.

It’s OK to say I don’t know

I don’t know.

I’ve said it a lot. I’m still here, still alive, the world didn’t come to an end. No one punished me for it. The only thing that happened is that I learned new things I didn’t know before. And guess what? Learning new things is part of the job.

Saying “I don’t know, can you show me please?” is perfectly fine. If we ask for help, we will get it. People like helping.

Knowing the business domain is important

We, programmers, are a smart bunch of people. We solve problems for a living. Without knowing what is the actual problem the business is trying to solve and just waiting for others to give us a solution which we need to translate into code, takes away the problem solving for which we initially signed up for. The business will also miss out on properly utilizing the experience we gained so far.

Understanding the core domain makes it possible to give ideas, work together with other people (not necessarily programmers) to come up with better solutions. Everyone will benefit from this. The business gains by having yet another smart person helping out, and you by learning new things.

Not everything we learn need to be exclusively about code.

Ask why?

This goes hand in hand with knowing the business domain.

Keep asking why. Why is some new feature being implemented, why do they need it? If you are joining a project that is being developed for some time, ask why were some things done in a certain way. It will both make learning the business domain easier and faster and it will also help with getting to know the codebase.

Asking why shows the business owners that you care, and caring about the same things as they do will only be helpful during the project’s lifetime. They will provide help and explanations much easier.

Onto new adventures

Working on this huge project for this long is something I’m truly grateful for. Not everyone gets an opportunity like this, especially this early in their professional career.

I learned a lot from my friend, partner and mentor, Srdjan, as well as from Luka who joined our small team recently.

I’m certain the new year will bring us exciting new challenges. If you have, or know of a project where the three of us could help out, let us know.

The Code4Hire team is here to help.

Tags: about, learning, me, random.
Categories: Blablabla, Development, Programming.

Hiking the Uvac special nature reserve

by Robert Basic on July 27, 2016.

In 2014 my wife Senka and I went on a camping vacation in Greece, on the Lefkas island. It was the first time camping for her, while I did some camping the year before. We quickly realised that we both enjoy camping very much and agreed to go on as many camping trips as possible.

The following year we went on a 12 day long camping and hiking vacation in Italy. The weather had different plans for us, so we only managed to do two hikes there — one in Seiser Alm and one in Cinque Terre.

This year for our honeymoon we went to Norway where we managed to do an amazing 4 hikes for the 8 days we were there. The view from Preikestolen is mind-boggling.

This past weekend the two of us went on a camping and hiking weekend getaway at the Uvac special nature reserve. Apparently this was our 10th hike so I thought it would only be fitting to remember it with a blog post. I might write about our other experiences in the future.

We chose Uvac as we agreed to see more of our country, the entire region is just gorgeous, the nature is barely touched by humans and the reserve is the home to the endangered Griffon Vulture.

Choosing the trail

There are only a handful of resources online about the camping and hiking possibilities around here (this is mostly true for all of Serbia, not just the Uvac region). We found a couple of hiking trails that we liked and a detailed inspection of one of the trails on Open Street Map and Google Maps revealed there’s a camping site by the trail, on the banks of the Sjenica lake. I got in contact with the reserve’s custodians who got me in touch with the ranger who is responsible for that area. They were all very helpful over the phone and answered all my questions in a couple of minutes.

The trail is the Uvac meanders and Molitva (Prayer) peak trail.

Driving from Novi Sad

The drive from Novi Sad to the camp took us some 7 hours, with one stop. The route was Novi Sad — Šabac — Valjevo — Kosjerić — Požega — Užice — Zlatibor — Nova Varoš — Sjenica — camp. We left the city in the rush hour and the traffic was pretty heavy until Šabac which is some 70kms away. The road from there was surprisingly good, with only maybe two patches of the asphalt being really bad for a total of cca. 30km. A slow, but not a tiring drive all things considered. The nature along the way makes up for it.

Arriving at the camp

The path to the camp is not clearly marked on the road. There is a junction at which we had to go off of the main road and there’s maybe a kilometer or so of gravel road to get to the camp. I was hoping to arrive there while there was still some daylight left, but we ended up arriving just as the Sun set. We were welcomed by the campers and I’m not even sure there was an “official” person from the camp or from the reserve there. They helped us pick a spot for our tent and invited us for a barbecue dinner after we were all set up. A bottle of rakija was also going around.

The camp is not like the camps we stayed at before. It has no showers or toilette facilities. There’s one fountain with spring water and one of those wooden field toilets. There are no visible tent spots, it’s more of a who settles where kind of a camp. A bit chaotic, but it does have it’s charm. In the mornings the camp site and the surounding area was covered in a mist, really pretty sight while the Sun comes up over the hills.

All in all for the two nights we were there, it was good enough. We only paid the 100 dinars (less than 1 euro) entry fee to the park and that’s it. The actual camping was free, so we can’t complain about a single thing.

The hike

Saturday morning we got up a bit after 7am, had coffee and tea, some breakfast and prepared for the hike.

Senka made sandwiches and I packed the water, compass, maps and the likes for our hike. As usual we took way too much food, but the 9 liter of water was just enough. We drank more than 7 liters for the 7 hours we were out on the trail. The Sun was relentless that day.

The trail is nicely marked, it is both clearly visible and has the trail markings at regular distances. It was a bit overgown here and there, but nothing serious. It passes through, I think, two wooded parts at the beginning of the trail and after that it’s pretty much Sun all the way to the top and back. Pack sunscreen if you go in clear weather.

What we liked a lot was the fact that it wasn’t crowded. Every 30 minutes or so we would come across a group of hikers, have a short chat with them and then move along. We could enjoy the nature and the views on our own, but we still didn’t feel completely alone. Just the perfect sweet spot of “traffic” on the trail.

Apart from the hot Sun, there weren’t really any other problems with the hike. One mountain guide we came across told us that doing the hike in short pants wasn’t really smart because apparently there are snakes on the trail. Stupid from us not looking that up beforehand and preparing accordingly.

At the top of the trail there is a viewpoint from which we could appreciate the view and look at the huge scavenger birds flying around looking for food.

On our way back to the camp, we went down to the river and had a nice swim. There is one short path down from the trail to the river bank, but it is seriously overgrown and barely visible so be extra careful if you decide to do the same.

Other activities in the area

Apart from hiking, it also possible to go on a boat cruise down the river and back, with optional stops at a couple of caves to go spelunking as well as fishing. For these you’ll have to make prior arrangements with one of the guides or park rangers.

You can also try and buy some Sjenica cheese, which is sold by a household near at the top of the trail. People say it’s really delicious, but we haven’t tried it ourselves.

Happy hiking!

Tags: Griffon Vulture, Uvac, camp, camping, hike, hiking, nature, reserve.
Categories: Blablabla, Free Time.

Vimprovements

by Robert Basic on March 26, 2015.

One part where I always felt (and still feel) that I could improve on my Vim usage, is when moving around. I don’t use the mouse, I don’t use the arrow keys, but for a while now I felt that spamming hjkl to get from one place to another is not really efficient. To be honest, it is kind of easy to just press down jjjjjjj … to move down lines. Went a bit too far? Just kk back. But there has to be a better way.

First off, I installed vim-hardtime to break the habit of spamming hjkl. That plugin limits the number of times one can press hjkl in a set time frame. I have it set up to block me from moving for a second after pressing the same motion twice in a row. jj is OK, but if I want to do jjj, well…

And this gets annoying. I want to edit code, not sit around and wait!

Faster moving around

I know about relative line numbers. I tried using them. And I guess my brain is just not wired in such a way that I could find relative numbers easy to use.

The second plugin I installed is vim-easymotion. It is supposed to make moving around in Vim much easier. There’s a lot of stuff going on in there, it has a lot of features. For now, I use 2 bits from it - jump to anywhere with s and k and j to move in lines up and down. I especially like these in visual mode, makes selecting text real nice.

I started using : more to jump to specific lines, f and F to search on the current line, { and } to move in paragraphs. I’m also more comfortable with general search with / and ?.

One other pair of commands that help me reduce spamming jk is u and d to scroll the window up and down.

Faster working with files

The third plugin I installed is CtrlP. I stumbled upon it in a /r/vim thread and decided to try it out. Up until then I was using NERDTree exclusively to navigate around files and I can’t really remember when was the last time I hit n to open it since I have CtrlP. It’s just amazing to work with files now.

NERDTree still has it’s use cases, for example in a project where I don’t really know what files are in there, but for projects on which I work frequently… Oh boy! Wonderful stuff.

I left the default p for searching for files, but remapped <tab> to open CtrlP’s find buffer mode.

Misc

Other stuff I did to make working in Vim more comfortable…

I set leader to be . I had it as , for a long while, but realised that it’s to close on the keyboard to the . and I kept repeating the last command when I actually wanted to do some magical incantation.

I learned about :m[ove] to move and :co[py] to copy lines. Good stuff.

dap and cap pairs are also useful from time to time. They just simply delete, or change, around the current paragraph.

Finally, I added the following bit to my .vimrc to highlight the current line:

augroup CursorLine
    au!
    au VimEnter,WinEnter,BufWinEnter * setlocal cursorline
    au WinLeave * setlocal nocursorline
augroup End

So, that’s pretty much it. I don’t think that I’m super fast navigating around in vim, but it’s definitely better than some 3 months ago.

Next thing I want to tackle is using registers, and especially macros.

And read more of that nice :help holy-grail.

Tags: ctrlp, movements, plugins, vim.
Categories: Blablabla, Development, Software.

Configuring the trackpad and touchpad behaviour for Thinkpad T540p on Fedora 21

by Robert Basic on December 22, 2014.
Heads-up! You're reading an old post and the information in it is quite probably outdated.

This is the last post about the Thinkpad and Fedora. At least for a while. Promise.

With the new generation of Thinkpads, Lenovo decided to change the touchpad. They removed the 5 physical buttons from the touchpad area and left us with one bigger touchpad. To click anything it’s now either touch click (two-finger click for right clicks) or one can push the entire touchpad down, the clickpad. The touchpad has different regions for getting left/middle/right clicks. Sort of.

And for the first time I completely agree with reviews on the internet. This thing is horrible.

If you want both the touch and push clicks, forget it. It just won’t be usable how inaccurate this thing is. If the touch click is turned on, it will get in the way of your typing. You forget yourself and do a push click with the touch click enabled? Here’s some double/triple click for you. Just don’t even bother with the touch click, turn it off.

You’re left now with the trackpad and touchpad for movement, and the clickpad for clicks. Again, pain. You push down the touchpad to click aaand… Good luck and I hope you clicked the thing you wanted. Your finger will move, just a little bit and so will the cursor. And here’s the kicker. Touchpad movements can’t be turned off. At least not in a easy and intuitive way.

After quite some time searching the internet for a fix, I found a forum post explaining how to get this thing usable (sadly, I can’t find that post again to link to it):

Section "InputClass"
    Identifier "TrackPad with buttons only"
    MatchDriver "synaptics"
    Option "SoftButtonAreas" "65% 0 0 0 50% 65% 0 0" # emulate right and middle buttons
    Option "AreaBottomEdge" "1" # disable moving but not buttons
EndSection

Save this as 99-thinkpad-clickpad.conf in /etc/X11/xorg.conf.d/. The touch parts of the touchpad are disabled so we have the trackpad for movements and the clickpad for buttons. I just need to tweak the left/middle/right button clicks a bit more, because there are times when I accidentally do a middle click.

Oh, and now there’s no mouse scroll because that’s touchpad only.

Tags: clickpad, fedora, laptop, t540p, thinkpad, touchpad, trackpad.
Categories: Blablabla, Software.