Friday, January 29, 2021

Linear_dist Python

import math

p1 = ()
p2 = ()

print("input Vp1 Hp1 VHp1")
Vp1 = int(input())
Hp1 = int(input())
VHp1 = int(input())

p1 = (Vp1, Hp1, VHp1)

print("input Vp2 Hp2 VHp2")
Vp2 = int(input())
Hp2 = int(input())
VHp2 =int(input())

p2 = (Vp2, Hp2, VHp2)

v_1= tuple(map(lambda p1, p2: p1 - p2, p1,p2))

v_1_vd = v_1[0]
v_1_hd = v_1[1]
v_1_vhd = v_1[2]

LD = math.sqrt((v_1_hd**2) + (v_1_vd**2) + (v_1_vhd**2))
print("LD =", LD)

Powershell Script to start and clean Google Chrome

   # Run before opening Chrome

#  get Chrome Process 

if ((Get-Process "chrome" -ErrorAction SilentlyContinue) -eq $Null)  {
    echo "Google Chrome Not Running"
}

else{
    echo "Running"
    taskkill /f /IM "chrome.exe"
    Sleep 3
}

start-Sleep -Seconds 5

echo ""
echo "******************************************"
echo "*Clearing Cache, Credentials & Login Data*"
echo "******************************************"

$Items = @('Cache\*',
           'Cookies',
           'Login Data')
$Folder = "$($env:LOCALAPPDATA)\Google\Chrome\User Data\Default"
$Items | % {
    if (Test-Path "$Folder\$_") {
        ls "$Folder\$_"
        Remove-Item "$Folder\$_"
    }
} 
echo ""
echo "***************************"
echo "*Poweshell Script Complete*"
echo "*Starting Google Chrome   *"
echo "***************************"
echo ""

#$FolderC ="$($env:LOCALAPPDATA)\Google\Chrome\Application"
cd 'C:\Program Files\Google\Chrome\Application' 
#& ./chrome.exe 'www.google.com'
#Test-Path "$FolderC"
.\chrome.exe

25 years on (Time to Blog)

My first experience of computing that I can remember was as a child my friend Steven who had blonde hair, a Labrador and a younger sister Louise and we all liked playing with stag beatles.  He showed me his Commadore 64, This was the must have for any 80's child with its tape cassette and cartridge ports.  About 16 years before game pads,. This was a time of Joystick and Keyboard and many hours of fun.





We where happy with the 8 bit graphics and litterally got square eyes.  Soon Stevens mum saw an opportunity to educate us and save some money on the latest titles by giving us a program your own space game book.

We both thought Jackpot!  Games for days,. So we started reading the book which gave instructions on how to load the white tape & press record  to bring up BASIC and use the code given to write our first program. 

Move on to 2021, it is now possible to learn any programming language from your smart phone , interpreter included.

I hope you find this Blog site useful as I am going to share code and my thoughts along the way.


Gammon => Ham Calculator V1.0

def ham_cooking_time (grams): """ Calculates the cooking time for a ham based on its weight. Args: g...