Sunday, January 07, 2024

Learning Python

 Here is python code for a program I am working on:

import matplotlib.pyplot as plt

import numpy as np

def draw_right_triangle_with_angles_and_side(angle_A, angle_B, angle_C, side_AC):

    # Check if the angles form a valid right-angled triangle

    if angle_A + angle_B + angle_C != 180 or angle_B != 90 or not (angle_A > 0 and angle_C > 0):

        print("Invalid input: The angles provided do not form a valid right-angled triangle.")


    # Calculate the length of side BC using the Pythagorean theorem

    side_BC = np.sqrt(side_AC**2 - side_AC**2 / np.tan(np.radians(angle_A))**2)

    # Define the vertices of the triangle ABC

    vertices = np.array([[0, 0], [side_BC, 0], [0, side_AC]])

    # Plot the triangle ABC

    plt.figure(figsize=(6, 6))

    plt.plot(vertices[:, 0], vertices[:, 1], label='Triangle ABC', marker='o')

    # Label the vertices

    plt.text(vertices[0, 0], vertices[0, 1], 'A', ha='right')

    plt.text(vertices[1, 0], vertices[1, 1], 'B', ha='left')

    plt.text(vertices[2, 0], vertices[2, 1], 'C', ha='right')

    # Set axis limits and labels

    plt.xlim(-1, max(side_BC, side_AC) + 1)

    plt.ylim(-1, max(side_BC, side_AC) + 1)



    # Add legend


    # Show the plot


    plt.title('Right-Angled Triangle ABC')

# Example usage

angle_A = 45  # Angle A in degrees

angle_B = 90  # Angle B (right angle) in degrees

angle_C = 45  # Angle C in degrees

side_AC = 14   # Length of side AC

draw_right_triangle_with_angles_and_side(angle_A, angle_B, angle_C, side_AC)

Friday, June 25, 2021

The Psychological Benefits of Commuting to Work

Many people who have been working from home are experiencing a void they can’t quite name. Article in The Atlantic

Friday, April 30, 2021

 Changed the Boing Boing feed in the sidebar to Wired.

Thursday, May 07, 2020

Friday, October 02, 2015

Updated My Blog - After Five Years

Updated my blog after five years. Cleaned out some of the cruft on the side bar, added my Twitter feed.

Wednesday, September 23, 2009

Fixing Bad GeekTool 3.0 Scripts

While playing around with GeekTool 3.0, I managed to put in a bad shell command, that caused both GeekTool and System Preferences to become unresponsive.

Since I couldn’t launch the GeekTool preference pane without crashing System Preferences, there was no way for me to delete just the offending shell command. I didn’t want to trash GeekTool and reinstall, since I had eight other scripts (geeklets as they are called in 3.0) that I didn’t want to lose. I needed a way to just delete the one bad shell script.

A Google search turned up nothing, so I poked around the files on my hard drive — and I found the file that contains the GeekTool configuration: in “\\users\username\Library\Preferences”. I double clicked on the file and it opened with Property List Editor. I expanded the keys under the root, and found the key associated with the offending geeklet and deleted it.

I was then able to launch the GeekTool preference pane without a problem.

Sunday, June 08, 2008

The 100 Greatest Guitar Songs of All Time

Every song here has those thrills. But these are rock's greatest guitar moments because of what's inside the notes: hunger, fury, despair and joy, often all at once.
This is a interesting list of songs - in addition to the guitar standards one would expect (Purple Haze), there are surprises as well, (People Get Ready and Beat It). Full list one one page.

read more | digg story

NASA Photo of the Day: Mars Soil Sample

What surprises are hidden in the soils of Mars? To help find out, the Phoenix Lander Phoenix Lander which arrived on Mars two weeks ago has attempted to place a scoop of soil in Phoenix's Thermal and Evolved-Gas Analyzer (TEGA).

read more | digg story

Wednesday, January 16, 2008

Quote of the Day

Illegal aliens have always been a problem in the United States. Ask any Indian.
Robert Orben

Wednesday, December 19, 2007

The Two-Hour Star Wars Holiday Special in only Five Minutes!

More about this at Wikipedia, which quotes David Hofstede, author of "What Were They Thinking?: The 100 Dumbest Events in Television History", saying it was "the worst two hours of television ever". It was broadcast only once — in 1978. Via MacBreak Weekly. Full length version. Happy Holidays!

Sunday, September 02, 2007

Apple iPhone Repair Dream

As I mentioned in my post "Nokia Phone Repair Nightmare", I planned to purchase an iPhone to replace my Nokia 6682 when the iPhone came out in June.

Well, I did purchase an iPhone and I am very happy with. However, I did manage to damage it and had to send it in for repair. This gave me the opportunity to compare Apple's service against Nokia's. To summarize my Nokia repair experience: Nokia took two months to determine that they could not fix my phone. And I had to call them repeatably to get status updates on my repair; their status web page was useless.

My Apple repair experience was completely different. I took my phone to an Apple store, they took care of the paperwork and shipping. I dropped it off on a Thursday night, Apple repair received it on the following Monday, and fixed it the same day! I received it back on Tuesday. I received emails every time my repair status changed, and was able the check the repair status on Apple's repair status page (which was always current, unlike Nokia's status page).

Apple has put a lot of thought and planning into their repair process, and as a result has a very happy customer.

Saturday, May 19, 2007

Hijacked Disney Characters Explain Copyright

Epicenter - Wired Blogs: "Disney lawyers' heads must be spinning over this one. A movie posted on Stanford University's site called 'A Fair(y) Use Tale' mashes up all your Disney favorites to humorously and effectively explain copyright law. "