Skip to main content

Posts

Installing Docker on Azure (Linux) Virtual Machine

Step 1. Update the apt package index: sudo apt-get update Step 2. Install packages to allow apt to use a repository over HTTPS: sudo apt-get install \     apt-transport-https \     ca-certificates \     curl \     software-properties-common Step 3. Add Docker’s official GPG key: curl -fsSL https://download.docker.com/ linux/ubuntu/gpg | sudo apt-key add - Step 4. Set up the stable repository (command depends on system architecture): sudo add-apt-repository \     "deb [arch=amd64] https://download.docker.com/ linux/ubuntu \     $(lsb_release -cs) \     stable" Step 5. Update the package index again: sudo apt-get update Step 6. Install the docker-ce package (the service should start automatically after installation): sudo apt-get install docker-ce Step 7. Verify that docker installed properlty: sudo docker run hello-world

Solving SSH connection issue with Linux Virtual Machine in Azure

I created a Linux Virtual Machine in Azure, but connecting to it through SSH was a real nightmare. I was always getting the below error - "Permission denied (publickey)."  After lot of googling, binging and shooting in the dark, this is how I fixed the problem: Create a new ssh key by running below command.            PS: Do not change the default name or path of generated ssh key.           ssh-keygen -t rsa -b 2048           Generating public/private rsa key pair.           Enter file in which to save the key (/c/Users/<Username>/.ssh/id_rsa):           Enter passphrase (empty for no passphrase):           Enter same passphrase again:         ...

Customized Crosshair with OxyPlot charting library

I am using Oxyplot to draw heatmap for a WPF project and needed to draw a crosshair that moves according to user clicks. Since I couldn't find any good example or documentation on the topic, I made a small hack by using LineAnnotations and by over-riding Oxyplot mouse click event. Here is the sample code using WPF with MVVM pattern- MainWindow.xaml <Grid>         <oxy:Plot x:Name="CrossHairPlot">             <oxy:Plot.Axes>                 <oxy:LinearAxis Key="MyXAxis" Position="Bottom" IsZoomEnabled="False"/>                 <oxy:LinearAxis Key="MyYAxis" Position="Left" IsZoomEnabled="False"/>                 <oxy:LinearColorAxis Key="...

Sharing a folder from Windows 10 host to Ubuntu in Virtual Box

1. First things first! Make sure that you have the latest VirtualBox Guest Additions installed. There are two ways to install it     a. From Ubuntu Desktop Menu Option: Start your VM and select " Devices > Insert Guest Additions CD image ..."     b. From command line with sudo permissions: Execute "VBoxLinuxAdditions.run" file. In my case, it was under path - "/media/VBox_Gas_5.2.6".     sudo /media/VBox_Gas_5.2.6/VBoxLinuxAdditions.run   2. Now share the folder between Windows 10 Host and Ubuntu Guest     a. Create a directory in Windows on any location of your choice.     b. In the VirtualBox, go to the settings of the Ubuntu Guest.     c. Under the Shared Folder section, add the location of you folder created with full permission.     d. Start the ubuntu guest and add your user to the vboxsf group:      sudo usermod -aG vboxsf $(whoami)   ...

How to run Firefox after installing Windows 10 creators update

I updated my Windows machine to use creator update and among other surprises, Firefox suddenly stopped to run. It was shown in the Task Manager, but I didn't see anything in Taskbar and the browser wouldn't open. Finally, I found the fix from the below link. This easy solution helped me to get the Firefox app running back again in no time. [Fix] How to run Firefox after installing Windows 10 creators update Here is the summary of needed steps - 1. On the Windows Explorer, go to address bar and type: %appdata%\Mozilla and press enter key. This will take you to the Mozilla folder in AppData folder where additional data and information regarding user program settings and preferences are stored. 2. Once you are inside the Mozilla folder, head to the address bar again and click the “Roaming” word. Doing this will take you the the upper level directory which contains the Mozilla folder. 3. Once in the Roaming folder, go and delete the Mozilla folder. Deleting the Mozilla f...

Getting SQL Server Database Size using Python on Windows

Pre-requisites: 1.        Install SQL Server or an Azure SQL Database: I have tested it with SQL Server 2012 installation 2.        Get Python: https://www.python.org/ downloads/ 3.        Get Microsoft ODBC Driver 11 or 13 for SQL Server Windows:   https://www.microsoft.com/en- us/download/details.aspx?id= 50420 4.        Install 'Pyodbc' library using pip or any other package manager of your choice   Here are the main parts of Python Script that fetches DB size -   Import Pyodbc library import pyodbc Define database variables server = <ServerName> database = <DBName> username = <UserName> password = <Password>  Define Database Connection String cnxn = pyodbc.connect( 'DRIVER={ODBC Driver 13 for SQL Server};SERVER=' + server + ';   ...

Recursively deleting files in Windows

Due to a magical feature of OneNote software, one day I noticed lots of files with extension ' .onetoc2 ' in one of the folder and each of it's subfolders.  I found the below solution using wildcards with ' del' command and '/S ' switch to remove them completely and recursively -  1.   Open command prompt and go to home directory where you want to perform this operation             cd MyFiles 2.   Run the below command – del /S  *.onetoc2 PS: There's a huge difference between running del /S *. onetoc2 and del /S C:\*. onetoc2 .  The first command is executed from the current location , whereas the second is executed on the whole drive .