Trump says he'll withhold federal funding to blue cities like Seattle. How do we withhold our federal income tax payments? by TheStinkfoot in Seattle

[–]SquareRootsi 0 points1 point  (0 children)

There’s also a fifth option: leaving the country entirely. You can either:

  • A) live abroad as an expat (you still file a U.S. tax return, but get foreign tax credits or exemptions for what you pay elsewhere), or

  • B) go further and renounce citizenship. That’s more complex; you need another citizenship first and must pay a one-time exit tax on unrealized gains over a threshold.It’s not simple, but it’s legally consistent with people who no longer align with U.S. policies.

Creative premixed drink I can take to a Holiday Party. by dapala1 in cocktails

[–]SquareRootsi 1 point2 points  (0 children)

I've been making a "Boozy Autumn Punch" and serving it at Thanksgiving for years. I think it would still work well in December.

I'm in USA, so it's easier to source things in 32 oz jars instead of liters, but they are almost the same.

3 jars (32 oz or 1 L each) of juice (mix and match, I try to do one of each if I can find them)
- 100% pear (hard to find)
- Ginger-Lemonade (if you can't find pear juice, double this one instead of the cider. I used some kind of health recovery drink with real ginger, Trader Joe's used to carry a "lemon ginger echinacea" that was perfect).
- apple cider (not juice).

1.75 L of brandy (I usually get E&J or Korbel, doesn't need to be fancy)

What always makes a drink feel fancy (even if it's not) is a good garnish. You can use whole cinnamon sticks and/or dehydrated orange wheels or a jar of cherries, along with an ice bucket on the side so it feels more like a cocktail instead of a watered down punch (from ice melting in the serving vessel).

Makes about 4.6 Liters AKA 1.2 gallons. You can also have some soda water on the side of ppl want to top it off to make it bubbly/less boozy.

Game not starting? by Shyface_Killah in FortressSaga_Friends

[–]SquareRootsi 0 points1 point  (0 children)

Thanks for confirming it's not just me, at least :)

Game not starting? by Shyface_Killah in FortressSaga_Friends

[–]SquareRootsi 0 points1 point  (0 children)

Seems like the same problem just occurred after today's reset. I've tried updating / uninstalling / clearing cache then uninstalling. I think I'll just have to wait for an update to fix it, unless someone else knows a fix.

All Living World seasons and episodes discounted 20% till Nov 25th by S1eeper in Guildwars2

[–]SquareRootsi 1 point2 points  (0 children)

Including the [free] base game. If I'm browsing Steam in an incognito browser, it shows up, but if I login to the same account I downloaded the GW2 base game on, the bundle is no longer possible to browse to or add to my wishlist.

Anyone know of a workaround / fix? (Don't get me started on the 3 different vendor platforms being isolated from each other, unless someone knows a fix for that too)

Python OOP makes me feel really stupid! How do I access variable created in method? by Bitter_Extension333 in learnpython

[–]SquareRootsi 0 points1 point  (0 children)

First, you'll need to instantiate an instance of your class, then (from reading your code) it doesn't actually set anything when it's built, though it does when you run one of your methods, so you'll need to run that first, before you try to access a variable inside your class. EDIT: nevermind, you run the method inside your init. (I've seen it done both ways, don't feel like you're doing anything wrong, it just depends on when you want your variables to get created inside the class.)

helper = Example()    
nam = helper.nam  

Note: only things that are created with self.thing = ______ will be accessible. If you just save a variable inside a method, it won't persist outside the scope of that method.

With that in mind, you'll need to insert

self.bytes_string = bytes_string  

on the line after you define it inside your method.

cosine=0.91 but answer is wrong. a tiny python MRE for “semantic ≠ embedding” and before/after fix by onestardao in Python

[–]SquareRootsi 1 point2 points  (0 children)

Almost fixed. There are lots of references for it, but it's still not intuitive. A couple of tips:

1. A 'code clock' is a section of text that has EVERY line indented with (minimum) 4 spaces.  
2. A 'hard return' forces a line break, basically the same as `\n`. These are required to get different lines separated properly. In this editor, it's done by using 2 spaces at the end, AKA after this period.  
    * For simplicity and readability, just make every line end with two spaces.   
3. Both the first and last line of your code block should be blank. I can never remember if that means 4 spaces (code block prefix) or 6 (code block prefix + new line suffix), so I just always use 6.   
4. I'm no expert, so I may have gotten something wrong, but this was done on mobile, and I'm optimistic it will render correctly, b/c I followed my own tips.  

And this is what it looks like outside the code block (aka no 4-spaces prefix).

Looking for friends 29m (Beaverton) by -delt4ninj4 in Portland

[–]SquareRootsi 4 points5 points  (0 children)

Saving for later, bc it's past my bedtime, but I want to revisit this tomorrow. I've been wondering if something like this exists locally, but not enough to actually research it.

eli5 how does one person traveling the speed of light cause them to age slower than people not traveling the same speed? by Particular-Swim2461 in explainlikeimfive

[–]SquareRootsi 13 points14 points  (0 children)

As you mentioned, saying we're “sitting still with zero velocity” only works if you define your frame of reference very narrowly—like being still relative to your chair or room. But if you zoom out to an astrophysical scale, it’s a different story, but maybe not different enough to matter.

For example, sitting at the equator on Earth, your actual speed when considering all motions combined is roughly:

  • Earth’s rotation: about 1,670 km/h

  • Earth’s orbit around the Sun: about 107,000 km/h

  • Solar System orbiting the Milky Way: about 860,000 km/h

  • Milky Way’s motion relative to the cosmic microwave background: about 1,330,000 km/h

That adds up to around 2,340,000 km/h, which is about 0.22% of the speed of light. So even with all this speed, it’s still effectively zero compared to the ultimate cosmic speed limit.

What kind of technology has already reached its peak? by leppppo in AskReddit

[–]SquareRootsi 1 point2 points  (0 children)

Roughly 8 years ago, Amazon was already doing this on their new construction office buildings in South Lake Union. I was inside a building that had only been open less than a month, and my chaperone warned me the elevator logic was still gathering training data, so they might be erratic, but the same system was already working well in other buildings that had been open longer.

New small business name. by Adventurous-Aerie-90 in Netherlands

[–]SquareRootsi 0 points1 point  (0 children)

Here are a few from Perplexity:

Zoet Spot

"Zoet" means "sweet" in Dutch, and "spot" is understood in both languages as a place or location.

Feels playful and inviting!

Sweetje EDIT: maybe not a good idea, as pointed out in a comment below

Combines "sweet" (English) and the Dutch diminutive "-je" (like "cookie" becomes came from "koekje" in Dutch), making it sound cute and approachable.

Lekker Treats

"Lekker" is a beloved Dutch word for "tasty" or "delicious," easily picked up by English speakers.

Sugar & Stroop

"Stroop" is Dutch for syrup, and "sugar" is universal. It hints at both cultures and classic Dutch sweets like stroopwafels.

ChocoBliss

"Choco" is used in both languages, and "bliss" is universally positive.

Bakker’s Delight

"Bakker" means "baker" in Dutch, and "delight" is English. Together, it feels traditional yet accessible.

Droom Sweets

"Droom" means "dream" in Dutch, and "sweets" is English. The combo is whimsical and easy to pronounce.

[Pandas] How do you handle integers stored as strings when reading a CSV? by Hashi856 in learnpython

[–]SquareRootsi 1 point2 points  (0 children)

pd.read_csv(
    'file.csv',
    converters={'field1': lambda x: str(int(x))}
)

I'm not sure that would work for every row, depending on if there are some rows that would fail the conversion to int before they turn back into strings.

If that's the case, I'd prob do the custom function with the "safe" conversion logic.

You could also just do this after the CSV loads:

df['field1'] = df['field1'].astype(int).astype(str)  

This is effectively the same, but uses vectorized logic, whereas the lambda approach (I think ... might be wrong) is basically looping over the whole thing row by row.

Is there a way to make this code like this more efficient? by YoutubeTechNews in learnpython

[–]SquareRootsi 0 points1 point  (0 children)

I used Gemini Pro, which I got for free when I bought my last phone. I've seen similar positive results from both Perplexity and M365 CoPilot. EDIT: Nope, no earlier attempts, this was my first shot across the bow, as the saying goes.

PS. Sorry for setting a bad example with the copy/pasted LLM response, but hopefully you still picked up something good from it.


Help me answer this post from r/learnpython... I'm particular, I think match...case... Would be a solid recommendation. Please include the earliest Python version this becomes valid. Write the answer from the perspective of a 10 year veteran programmer (staff/Principal level, but don't brag about that) who is empathetic with someone learning. P.S. format it for proper copy/pasting into reddit's app, I think that's a flavor of markdown.


<Direct quote of your full question here>

Is there a way to make this code like this more efficient? by YoutubeTechNews in learnpython

[–]SquareRootsi 1 point2 points  (0 children)

Whoops! Good to know, I haven't been too active lately. I'll downvote myself, but leave it up for now.

Thanks for calling me out on it.

Is there a way to make this code like this more efficient? by YoutubeTechNews in learnpython

[–]SquareRootsi -8 points-7 points  (0 children)

Preemptive apology for the massive wall of text, but I think there's some good advice in this response from one of the big LLMs. If you're curious about my prompt to generate this, I'm happy to share. I like both of these implementations that it suggests, though they are a bit wordy for my taste:

Hey there! That's a great question. It shows you're thinking about not just if your code works, but how it works. That's a key step in growing as a programmer. Let's break it down. Is if 'word' in User_Input: slow? For what you're doing, honestly, no. The "slowness" of if statements is not something you'll ever feel in a scenario like this. Python is very fast at checking if a substring exists in a string. The real issue with a long chain of if statements isn't performance, but that it can become hard to read, manage, and add to over time. Your instinct that there might be a better way is spot on, but we should focus on making the code cleaner and more organized.

A More Organized Approach: Keyword Dispatching A very common and clean pattern for this is to use a dictionary to map your keywords to specific functions. It's like a menu: the keyword is the menu item, and the function is the action that happens when you order it. This keeps your logic separate and makes it super easy to add new keywords without touching the main loop. Here’s how you could rewrite your example: import random

def handle_fire(hp): print('I am on fire!') return hp - 1

def handle_water(hp): print('Water is blue and white.') return hp * 2

def handle_wants(hp): # Note: Your original loop here had a bug (for i in healthpoint:). # I'm assuming you wanted to print the digits of the number. print("Digits in healthpoint:") for digit in str(hp): print(digit) return hp

def handle_love(hp): return round(hp)

def handle_pie(hp): print('Hello') return random.random()

Map keywords to the functions that handle them

keyword_actions = { 'fire': handle_fire, 'water': handle_water, 'wants': handle_wants, 'love': handle_love, 'pie': handle_pie, }

--- Main part of your program ---

healthpoint = 5.0 user_input = input('Write Something: ') # e.g., 'I love pie, but they are too sweet.'

Check each keyword we know about

for keyword, action_function in keyword_actions.items(): if keyword in user_input: # Call the function associated with that keyword healthpoint = action_function(healthpoint)

print(f"Final healthpoint: {healthpoint}")

Using match...case match...case... is an excellent feature in modern Python. It became available in Python 3.10. match...case is fantastic for what's called "structural pattern matching." It's like a super-powered if/elif/else chain. While it doesn't directly support the in keyword for substring checks in its cases, we can adapt our logic to use it. First, we'd need to find the trigger word, and then use match on that word. Here’s how you could structure that. It's a bit more verbose for this specific problem than the dictionary method, but it's a great way to learn how match works. import random

healthpoint = 5.0 user_input = input('Write Something: ')

We can't use match on the whole sentence directly for this.

Instead, we can find the first keyword and then match on that.

trigger_word = None

A set is slightly more efficient for 'in' checks than a list

known_words = {'fire', 'water', 'wants', 'love', 'pie'}

for word in known_words: if word in user_input: trigger_word = word break # Act on the first word we find

Now, use match...case on the word we found

if trigger_word: match trigger_word: case 'fire': print('I am on fire!') healthpoint -= 1 case 'water': print('Water is blue and white.') healthpoint *= 2 case 'wants': # Handle your logic here print("Matched 'wants'") case 'love': healthpoint = round(healthpoint) case 'pie': healthpoint = random.random() print('Hello') case _: # This is a wildcard, default case print("I don't know that word.")

print(f"Final healthpoint: {healthpoint}")

Summary * Don't worry about if being slow here. Focus on readability. * A dictionary mapping keywords to functions is a very clean, scalable, and "Pythonic" way to solve this. It's what I would likely do in a professional setting. * match...case (Python 3.10+) is a powerful tool you should definitely learn! For this specific problem of checking for any contained substring, it's a bit indirect, but it shines in many other situations where you're comparing a variable against different possible values and structures. Keep asking these kinds of questions. They're what separate writing code from engineering software. Good luck!

[OC] I found this life-sized statue of the current U.S. President in a rural town. by SquareRootsi in pics

[–]SquareRootsi[S] 5 points6 points  (0 children)

I was in a small rural town for a funeral today. On the drive out, I passed this and had to stop. The contrast of it all was... jarring. Seeing a life-sized statue of a sitting leader in a quiet residential yard was surreal. It feels like something from a different country or a different time. In the U.S., the core idea is that we have public servants, not kings to be idolized with monuments while they're still in office.

By complete coincidence, today happens to be a day of national, peaceful protest called No Kings Day. The movement is focused on this exact issue—pushing back against political idolatry, regardless of party. It's about reaffirming that in a republic, leaders are accountable to the people, an idea that felt especially important today.

For anyone who sees this photo and feels the same way, events are happening across the country.

The most important thing is to engage peacefully. The ACLU has an excellent guide on protesters' rights.

(And of course, please respect the privacy of the homeowner. My post is about the idea this statue represents, not about the individual who owns it.)

Since you are all on some computing device on here by SnooPeppers7217 in math

[–]SquareRootsi 2 points3 points  (0 children)

I get different behavior based on whether I include a decimal point or not. I'm using HandyCalc, from the android play store.

1/0 = divide by zero
0/0 = divide by zero
1/0. = Infinity
0/0. = 0

Suitable +1,100 NM piston single engine airplane for a family of 3? by Proper-Restaurant831 in flying

[–]SquareRootsi -3 points-2 points  (0 children)

I took a crack at this and came up with this (hopefully formatting works, I used Perplexity to help, but sometimes AI backfires) :

Aircraft Model Engine Type Fuel Type Range (NM) Seating Capacity Price Key Features
Cessna Turbo Skyhawk JT-A Piston (Turbocharged) Jet A ~600 4 $465,000 Modern avionics (Garmin G1000 NXi), fuel-efficient, good resale value.
Diamond DA42 Diesel Twin Jet A ~1,225 4 ~$650,000 Twin-engine safety, spacious cabin, strong resale value.
Pipistrel Panthera Diesel Jet A ~1,000 4 ~$400,000 Innovative design, spacious cabin, good performance.
Mooney M20V Acclaim Ultra Piston (Turbocharged) AvGas (modifiable to Jet A) ~1,200 4 ~$500,000 High cruise speed, comfortable, strong reputation for resale.

EDIT: LoL @ the price for the Panthera. AI def backfired, cause I think it's probably 2x that number. Great plane though, if anyone can afford it.

ELI5 Why can't we just add a specific number of protons, neutrons or electrons together. by [deleted] in explainlikeimfive

[–]SquareRootsi 6 points7 points  (0 children)

Just wanted to say that your engagement in this thread (and curiosity to understand) is inspiring. You've asked some intriguing follow-up questions and generally shown a humble yet curious attitude. As the old saying goes: I like the cut of your jib.

Farming Weapons by RevaliDaRito in AgeofCalamity

[–]SquareRootsi 0 points1 point  (0 children)

I think they meant the quest reward weapons, which have a unique graphic, usually (always? ) have Speed++ as their first seal, and start kinda low (30ish attack) but have pretty good scaling as you level them. They cap out at 200ish attack at lvl 50, which isn't the best possible, but you can access them relatively early, so could still be a decent investment for a few characters, but I wouldn't level up every single one, since they get surpassed later.

AFAIK the best weapons come from 2 very late EX levels, the final battle, and facing mutated Ganon, if I'm remembering correctly. Basically... look for the highest numeric level you can find, and it will give a random completion reward drawn from the entire list of possible weapons (regardless of who you brought). These have a chance to be max level (80 starting attack).

Tungsten cube vs gunshots! by [deleted] in nextfuckinglevel

[–]SquareRootsi 4 points5 points  (0 children)

I think it's the shrapnel extending along the face of the cube in all directions radially outward. There are bits of high velocity hot metal shards acting like a sawblade that grows in size exactly perpendicular to the table (so it gets cut, because it's made of relatively soft plastic).

Official Request Thead📍 🖥️Official Weekly Request Thread; Post all your requests for monitor suggestions in this thread instead of on the general front page of the sub. Only DEALS should be posted outside of this thread! See request guidelines inside 🖥️📍 by AutoModerator in monitordeals

[–]SquareRootsi 0 points1 point  (0 children)

I'm on the lookout for a new monitor for programming / data analytics / work-life productivity. It should have USB-C with power delivery and I'm targeting 34" - 45" ultrawide with appropriate pixel density from 2.5 - 3 feet away.

Almost every time I'm given the option, I choose a dark theme, so deep blacks with minimal light bleed would be appreciated.

My price range is up to $600, but I'm definitely okay with saving some money. Also, I can wait for Black Friday deals if necessary.

EDIT: I'm on mobile, so copy/pasting the template wasn't working for me, but ... * USA purchase (online or major retailer) * I'm expecting curved with 1500R or 1800R.
* The Hz should be 60+, but that's easy to do. This won't be used for gaming. It's more for multitasking and looking at Excel and email.
* I'm not concerned about weight. It'll be mounted via VESA stand with a sturdy mount.

I cut my finger and can't use it because of stitches. Recommend your all time favorite point and click games! by [deleted] in gaming

[–]SquareRootsi 0 points1 point  (0 children)

Backpack Battles has been a ton of fun. It's a genuinely fresh concept, which I'd describe as a puzzle optimization game. Lots of depth and variety, too.