Sunday, 2 October 2022

How to fix Apostrophes and double quotes not showing up in Windows


Recently I started using Windows 11 and realized Apostrophes (Single quotes) and double quotes not showing up until I type in the next letter. This behavior is really annoying, especially for me (I am from India/Asia) if you are wondering 😄 . This is most probably because you are using a US-international keyboard. In this post, I will show you how to fix this behavior.

Fixing "Apostrophes and double quotes not showing up in Windows"

As I mentioned before the issue is with you using the US-international keyboard. So you need to fix that.

I am using "Windows 11" so the below steps are keeping that in mind, but you would have similar steps in another version of Windows.

  1. Select Start > Settings > Time & language > Language & region.
  2. Under Preferred languages, select the options from 1st language you are using and click on "Language Options".

  3. Next, go under "Keyboards", here you will see the "US-International" keyboard installed. We need to remove this.
  4. Let's add the Keyboard we intend to use 1st. I am adding English (India) but you can choose the keyboard you want (Let's say English (United Kingdom)).
  5. Now select "US-International" keyboard from the list.

  6. Changes should immediately take effect.

Related Links

How to move TaskBar to the top or side in Windows 11


I recently started using Windows 11 and noticed there is no way to move windows TaskBar around. It is permanently fixed toward the bottom of the screen. I personally need the TaskBar towards the left or right of the screen and here's why - Our screen (Desktop or Laptop has more horizontal space than vertical space, hence it's only logical to keep TaskBar on the left or right of the screen so that it takes only horizontal space). Though there is no good way to move the TaskBar around there is a registry edit hack that does the trick. 

NOTE: If you are a normal windows user (Have not worked on programming and Windows internals before), I would recommend not to do the below but just live with TaskBar being on the bottom. Follow the below steps only if you know what you are doing and your own risk.

How to move TaskBar to the top or side in Windows 11

  1. Open "Windows Start" and search for "regedit" OR
  2. Go to "Run" (using ⊞ Win+R) and type "regedit" and press enter.

  3. You will get a prompt asking if you want to let the current user make changes to "Registry Editor". Press Ok.
  4. Next from the left hierarchy panel, you need to go to the following entry:
  5. Double-click the Settings binary key.

  6. Under "Value data" section click on the entry with the 2nd row and the 6th column (The default value would be 03). 

  7. Press the delete key and replace it with the 01 value to move the taskbar to the top. Press ok.

  8. You can replace them with the following values as you desire
    • 00: Move the Taskbar to the left
    • 01: Move the Taskbar to the top
    • 02: Move the Taskbar to the right
    • 03: Move the Taskbar to the bottom
  9. For changes to take effect you need to restart the "Windows Explorer" process.
    1. You can go to "Task Manager" and restart the "Windows explorer" process. OR
    2. Do it via "Command prompt" via the following commands.
      1. Open the command prompt from the start menu or from the run menu(⊞ Win+R) and "cmd" command.
      2. "taskkill /f /im explorer.exe"
      3. "start explorer.exe"

You will then see Taskbar move to the top of the screen.

NOTE: With the above steps, you can move the TaskBar to the right or left as well, but it's useless (It does not work as expected). Hopefully, Windows 11 team fixes this sooner but we have to live with it for now. I personally am not happy with the above as I really want my TaskBar on the right due to the reasons mentioned in the "Background section" at the top.

Thursday, 29 April 2021

How to fix issue of not able to click anything on Windows 10


Recently I came across an issue in Windows 10 where I was not able to click on icons. This was a relatively weird issue. What was happening is - I could click either on icons on the taskbar or icons on the desktop but not both. Also, cancel, minimize buttons won't work. This happened when I switched my mouse from USB to wireless. Anyways there are few ways we can fix this which I have listed below.

  1. Restart PC
  2. Restart File Explorer
  3. Use sfc (system file scanner)

Restart PC

Well, why not? This fixed the problem. There is not a lot of problems that restarting cant fix. But this is associated with system reboot time which I hate. I tried this for few times but quickly got tired of it. Restart every time I switch my mouse? Bad idea.

Restart File Explorer

If the issue was with explorer we could quickly try to kill File explorer and restart it. Go to Task Manager by
  • Ctrl + Alt + Delete
  • Ctrl + Shift + Escape
Find Windows Explorer and kill it

You can select the process and click delete. Or right-click and end process. To start it back in the same task manager go to File -> Run New Task (You can Also to Alt+F to open the file menu and then click and then click 'n' for new task)

Once you open a new task window - enter explorer in it and press enter.
Your windows explorer will start again.

Use Systems file checker (SFC)

This is what I use nowadays to fix this issue. My guess is some files get corrupted when I switch mouse or maybe the driver is buggy .. who knows! But running the following command fixes all.

Make sure you run the below command as administrator from the command prompt.
  • sfc /scanall

And the best part - No reboot required. This does take a couple of mins. But you can try browsing or something else at that time :)

Sunday, 24 May 2020

Decorators in Python


In the last post we saw what are closures in Python. In this post we will see what are decorators in python. Closures are heavily used in Decorators. Let's see how.

 Decorators in Python

As we know already everything in Python is an Object. A decorator is an object that is used to modify a function or a class. Function decorator takes a reference to the decorated function and returns a new function. It will internally call the actual decorated/referenced function.

You can also have a class as a decorator instead of a function. When we decorate a method with a class, that function becomes instance method of that class.

In either case the original code is not changed. 

Let us say we have a function that makes a remote API call and we want to monitor the start and end time for that API. You have a method as follows:

def make_api_call(*params):
    # Simulate API call

I have just added a sleep of 3 seconds to simulate the actual API call. So now if we want to monitor the start and end time of this API, we can modify this function to print time before and after the API call, but it is not correct to modify existing functions. This is where decorator comes into the picture.

from datetime import datetime
import time

def monitor_performance(func):
    def wrapper_func(*params):
        print("Making API call with params {} at {}".format(params,
        print("Finishing API call with params {} at {}".format(params,
    return wrapper_func

def make_api_call(*params):
    # Simulate API call
make_api_call("param1", "param2")

When you execute this code it prints the following output.
Making API call with params ('param1', 'param2') at 2020-05-24 22:31:19.480543
Finishing API call with params ('param1', 'param2') at 2020-05-24 22:31:22.484090

You can notice how we decorated our actual method make_api_call with a custom decorator monitor_performance. Also, you must have noticed our decorator function used a closure - another internal method called wrapper_func to actually monitor start and end time.

As I mentioned before the decorator can be used to modify the actual method and internally calls the actual method. In this case, before we call the actual method we print start and end time.

You would have also noticed that the parameters passed to make_api_call are automatically passed to our wrapper function as we are returning this wrapper function from the decorator. Also, notice how we have declared decorator for our function using '@' notation.

Using class instead of function for a decorator

The same above code can be done with a class as a decorator. As we already know everything in python is an object and it is callable if it defines the __call__() method.

from datetime import datetime
import time

class monitor_performace:
    def __init__(self, actual_func):
        self.actual_func = actual_func
    def __call__(self, *params):
        print("Making API call with params {} at {}".format(params,
        print("Finishing API call with params {} at {}".format(params,

def make_api_call(*params):
    # Simulate API call
make_api_call("param1", "param2")

It prints similar output as before:
Making API call with params ('param1', 'param2') at 2020-05-24 22:39:22.895176
Finishing API call with params ('param1', 'param2') at 2020-05-24 22:39:25.896923


  • You can also decorate a class with another class
  • You can chain decorated as well. Each decorated function/class will be called serially.

Related Links

Saturday, 16 May 2020

Understanding python closure


In the last couple of posts, we saw how we can pass multiple arguments in python functions and what are generators in python. Next, I want to explain what decorators are in python. Decorator is a very powerful feature of python but in order to explain it, we need to understand closure in Python. You must have heard of Javascript closures, these are kind of similar. We will see this in detail now.

Understanding python closure

Python closures are related to nested functions. Consider the following example:

def print_func(text):
    text_to_print = text
    def printer():
    return printer

print_function_reference = print_func("Hello World!")

What happens when you execute the above piece of code? It prints:
<function print_func.<locals>.printer at 0x7f21b16d1950>
Hello World!

So what's happening here?
We have defined a function called print_func which takes in a string argument which we like to print. Then this method returns a reference new method called printer() and when you invoke this method(reference) you see your value is printed.

But wait a second? I am good with the part where I get a reference of printer method as seen in output but when I invoke it how does it get the value of text_to_print? It does not seem to be in printer methods scope.
>> This is exactly what we call closure.

A couple of other pointers before we go to the definition of closure:

  • printer() function is called a nested function
  • A nested function has read-only access of variables defined in the outer scope. 'text_to_print' in this case.
  • Such variables are called "non-local" variables.
  • Everything in python is an object with set of attributes. Yes, even a function. They all have some common attributes like "__doc__".
So, Closure is a function object that is used to access variables from enclosing scope, even though they are not present in the memory(out of scope). Eg. 'text_to_print' in this case.

They are used to invoke functions not in scope. Eg. printer() in above case. Scope for printer() function is inside print_func() function yet we can invoke it from outside.

NOTE: You can try deleting print_func() and then invoke print_function_reference(). It will still work, even though it's closing function is deleted.

When and Why to use Closures?

As you can see closure help with data hiding. You don't need to define global variables. That's exactly the primary use case of closures.

They are used in callbacks and decorators. We will have a detailed post on decorators (stay tuned!).

Typically when you have a few methods you can go with closure. However, if you have multiple methods you are better off with a class.

You can also see closure contents as follows:

Related Links

t> UA-39527780-1 back to top