Changing default behaviour of the Contacts app in Oreo

When you open up the Contacts app second or the following time, it always shows last view (i.e. where I left it), i.e. the most recent contact search.

I am using this app purely for searching the contacts, so the need of tapping Back to go back to recent search results list and then tapping X to clear the last query each time I want to search for another contact simply kills me. This is as stupid UX approach as it can be.

Is there any way to change the default view, in which Contacts app opens by default each time?

My stack:

  • Motorola Moto Z2 Play,
  • Android 8.0 Oreo.

I am using the default, system Contacts app. No 3rd party solution.

Changing default behaviour of the Phone app in Oreo

Each time when I open the Phone app, I see Favourites tab (first one) as default.

This is completely useless for me, because Google uses its weird logic to tell me which contacts are my so called favourites and this logic produces completely wrong results — i.e. I see “favourite” contacts which aren’t truly my favourite ones.

This tab is also useless, if your contacts have more than one phone number, because instead of showing a list in this case and letting you pick the number, it always calls the default number. This isn’t working in my case, because I have a lot of contacts which I contact both privately (i.e. during weekends and evenings; using private phone number) and on business grounds (using company phone number). So using the default phone number and Favourites tab is pointless in my case.

For the above reasons, I am not using Favourites tab at all and I am always forced to switch manually to recent phones / call history tab.

Is there any way to make that tab displayed as default each time I open up the Phone app.

My stack:

  • Motorola Moto Z2 Play,
  • Android 8.0 Oreo.

I am using the default, system Phone app. No 3rd party solution.

Extrange behaviour on terminator split vertically shortcut

I have used terminator since eight years. I love splitting my terminal in several layouts depending on the task I am doing.

I upgraded (install from scratch) to Ubuntu 18.10 and I installed terminator. Current package version is:

dpkg -l|grep terminator ii  terminator              1.91-1        all          multiple GNOME terminals in one window 

I don’t have idea about what is happening. I suppose system key binding is in conflict with terminator, but I’m not sure.

os.chdir() caused unexpected behaviour with pyhton multithreading

I’m new to multi-threading in Python. In my code, I called a function which changes its working directory with chdir() as follows.

import threading import os import shutil  def sayHello(dirName,userName):     if not os.path.exists(dirName):         os.makedirs(dirName)     else:         shutil.rmtree(dirName)         os.makedirs(dirName)      os.chdir(dirName)     f = open("hello.txt","w")     f.write("Hello %s\n" %userName)     f.close()  thread1 = threading.Thread(target=sayHello,args=('hiDir1','Andrew')) thread2 = threading.Thread(target=sayHello,args=('hiDir2','Michael'))  thread1.start() thread2.start()  thread1.join() thread2.join() 

Expected behavior is,

  1. thread1 : Create “hiDir1” directory, create “hello.txt” inside “hiDir1” and print “Hello Andrew” in “hello.txt”
  2. thread2 : Create “hiDir2” directory, create “hello.txt” inside “hiDir2” and print “Hello Michael” in “hello.txt”

When I ran the code for the first time, it ran without errors. All files were generated correctly. But “hiDir2” was inside “hiDir1”.

Without deleting the generated files, I ran it for the second time. Both directories were there. But only “hiDir2” had the correct text file with correct message printed on file. “hiDir1” didn’t have the text file. Following error was popped.

Exception in thread Thread-1: Traceback (most recent call last):   File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner     self.run()   File "/usr/lib/python3.5/threading.py", line 862, in run     self._target(*self._args, **self._kwargs)   File "threadingError.py", line 9, in sayHello     shutil.rmtree(dirName)   File "/usr/lib/python3.5/shutil.py", line 478, in rmtree     onerror(os.rmdir, path, sys.exc_info())   File "/usr/lib/python3.5/shutil.py", line 476, in rmtree     os.rmdir(path) FileNotFoundError: [Errno 2] No such file or directory: 'hiDir1'ode here 

When I ran it for 3rd time without deleting the files, vice versa of the second time run occurred. Both directories were there. But only “hiDir1” had the text file with correct output. ‘hiDir2’ was empty. Following error message was there.

Exception in thread Thread-2: Traceback (most recent call last):   File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner     self.run()   File "/usr/lib/python3.5/threading.py", line 862, in run     self._target(*self._args, **self._kwargs)   File "threadingError.py", line 12, in sayHello     os.chdir(dirName) FileNotFoundError: [Errno 2] No such file or directory: 'hiDir2' 

When I ran this repeatedly, 2nd and 3rd occurrences occurred exactly one after other.(How can this happen? It should give the same output each time, isn’t it?)

As I understood, the issue is with ‘chdir()’. So I rearranged the code getting rid of ‘chdir()’ as follows.

import threading import os import shutil  def sayHello(dirName,userName):     if not os.path.exists(dirName):         os.makedirs(dirName)     else:         shutil.rmtree(dirName)         os.makedirs(dirName)      filePath1 = dirName+'/hello.txt'     print("filePath1: ", filePath1)     # os.chdir(dirName)     f = open(dirName+'/hello.txt',"w")     f.write("Hello %s\n" %userName)     f.close()  thread1 = threading.Thread(target=sayHello,args=('hiDir1','Andrew')) thread2 = threading.Thread(target=sayHello,args=('hiDir2','Michael'))  thread1.start() thread2.start()  thread1.join() thread2.join() 

Then, there was no issue. Code ran as expected. Is there anything wrong with os.chdir() when used in python multi-threading? Is this a bug in python threading module?

Thanks.

How do I change the behaviour of the defaults flag in fstab?

I want to add nofail to the defaults flag in my fstab so my system doesn’t boot in to recovery mode every time I plug in a new device and reboot. I know that I could just go and edit my fstab manually each time but that’s a massive hassle.

EDIT: I have figured out a stopgap solution writing the output of cat /etc/fstab | sed 's/nofail,//'| sed 's/defaults/nofail,defaults/' to /etc/fstab but it is both ugly and I have to manually remember to run the script after every (EDIT: new) drive gets attached.

Need correct iptable rules for proper behaviour

My AWS architecture has a public subnet having a NAT instance. It forwards the traffic on certain ports to my EC2 instance hosted in a separate private subnet.

sudo iptables -t nat -A PREROUTING -p tcp –dport 80 -j DNAT –to-destination 10.0.1.126:80

But I also need to provide outgoing internet access to my private EC2 instances.

sudo iptables -t nat -A POSTROUTING -o eth0 -s 10.0.1.0/24 -j MASQUERADE

This results in all the request generated by my private EC2 instance to loop back to itself. Which rule needs to be modified to prevent this behaviour and outgoing traffic generated by private EC2 instance are sent without being routed back?

Smart cards and the behaviour of the browser. Is the PIN cached?

When using smart cards for certificate-based authentication, is the PIN entered by the user to authenticate his smart card to the browser is cached? OR does the certificate gets cached by the browser? OR is it both?.

What are the differences in the behaviour of the browser between typical certificate authentication (certificate is imported to the browser) vs. certificate authentication via a smart card?

This is very similar to the question I want answers to, but it is unanswered. Does Chrome cache smartcard PIN?