How to set Python3 as default interpreter for VS Code | or set any version as default interpreter.

Want to run your python code with a particular python version in Microsoft VS Code? And, make it the default version?
Read on.
Make sure that the required version is installed. You check the available version and the path by running this command.

I am trying this on Apple Mac. It should be similar in Windows Machines as well.

 

Open the VS Code, at the bottom of the screen you will Terminal. If it is not visible, Go to View and then select Terminal.



Check the available python versions and their path. 


 % which python  

/usr/bin/python



 % which python2

/usr/bin/python2



 % which python3 

/Library/Frameworks/Python.framework/Versions/3.7/bin/python3


Next, 


Run this python code to check what version is used by default. 


import platform
print(platform.python_version_tuple())
print(type(platform.python_version_tuple()))



You will get this


('2', '7', '16')

<type 'tuple'>



Now you know the path and versions available.

In the VS code, go to the View menu and select Command Pallete



Now search for Python and you will get all the installed versions of Python.



Then select Python: Select interpreter. You will get all the installed versions of python. Select the one you want to be associated with your script.


Now run the same code again to check what is the default version set.


import platform
print(platform.python_version_tuple())
print(type(platform.python_version_tuple()))


('3', '7', '1') <class 'tuple'>


SOLVED | AdSense Approval Issues and Fixes for Site down or Unavailable | How to Fix

I tried to get an AdSense approval for my site but I got a mail from AdSense saying the site is down or unavailable. But the site is definitely accessible and all the other requirements are taken care of. The site is also very old and the domain itself is 3 years old. There are no issues with page views as well. 


Here is my situation.

I have an approved AdSense for YouTube. I got my blogger site upgrade to a top-level domain. This is the requirement to link your YouTube AdSense to your blogger site.  

I have taken care of all the requirements to apply for the AdSense for my site. 

1. Clean design and unique content. No issue with the design as I have created it using a blogger theme. 

2. About page, Contact Us Page, Privacy Policy Page. These are mandatory 

3. Top-Leve Domain


After applying for the AdSense I got the denial mail and looking at the reason, I was convinced that there must be a small mistake in the Domain setup or blogger settings.   

I tried these things and found the culprit. 

Make sure to check all these steps so that you will not get another denial. 


1. Check if the site is accessible with different combinations of WWW, HTTP and HTTPS 

krishtalk.com

www.krishtalk.com

https://www.krishtalk.com

http://www.krishtalk.com

Note that my site still runs without HTTPS, yet to add SSL certificate.  

All these combinations worked. 

So no issues at this point. 


2. Check the DNS settings from your Domain service provider. All CNAME settings were found to be good. Going wrong here has less chances,  if there are any issues with your domain settings, your site may not be accessible. 

So no issues found yet. 


3. Check if you have custom rebots.txt enabled 

This is one of the major reasons why approval is denied. Check the settings of your blog or you can just check the content of your robots.txt by appending robots.txt to the domain URL

http://www.krishtalk.com/robots.txt

Make sure that your robots.txt is not blocking any of the Google servers. 

This is the default robots.txt from my site. 

User-agent: Mediapartners-Google
Disallow: 

User-agent: *
Disallow: /search
Allow: /

Sitemap: http://www.krishtalk.com/sitemap.xml

checked my blogger settings and custom robots was turned off. 



This is also clean and not the culprit for my approval denial. 


4. Upload your sitemap to Google. 

I had done this before but, I did upload the sitemap.xml again. I am not sure if this will cause any issues. As long as your pages are searched from Google and you are getting the views then this should not be a problem. 

I do not think this was a problem for my site. 


5. While configuring your custom domain you might have selected the option "Redirect Domain". 

You will get an option to redirect your non-www site to www site under the Publishing tab of your blogger settings.  

like  krishtalk.com to www.krishtalk.com


When I checked this setting, it was turned on. I guessed this could be the issue. Since we are providing the non-www site while applying for AdSense. It is better to turn off this redirection. So Google can find and navigate the www site.

My guess was right. After changing this setting,  I again applied for review. After 2 days, I checked the status and it was approved. :) 


Thank you and let me know what worked for you. 


Notes: If you are applying for the AdSense for the first time for your blogger site, then you have to do it from within the blogger's earnings tab. 

If you already have an approved AdSense then you have to have a custom domain and from the AdSense account login, you have to apply for the site approval. 


How to create MS Word document automatically with Excel

MS Word and Excel can do wonders together.  You can do a lot of automation using these 2 applications for your small and medium businesses.  Here is one such solution.  

Generating the MS word report automatically using excel as a data source. Mail merge is used to link data from excel to word. Then a simple macro is used to get the desired record from Excel Spreadsheet.

Download the MS word document and Excel spreadsheet used in this video here

https://drive.google.com/drive/folders/0B4UB3eOhhY26TVdvQ3RucW1zb1E?resourcekey=0-YcGX4_XdYqt_C_dSztvA_A&usp=sharing

Please use this link

https://drive.google.com/drive/folders/0B4UB3eOhhY26TVdvQ3RucW1zb1E?resourcekey=0-YcGX4_XdYqt_C_dSztvA_A&usp=share_link

If you are not able to access this link, let me know. The link in my YouTube channel was not working, now I have uploaded the files here. 

How to copy screenshot to clipboard in New Apple Mac OS

If you have upgraded your Apple Mac OS to 14.x.x, then you may find it strange that the screenshots are not copied into the clipboard. The s...