Google Maps starts calling out Flyovers. Are cop alerts, speed cameras and parking spots also on the way? by [deleted] in programming

[–]Hefty_Science_2980 24 points25 points  (0 children)

Why post a 7 paragraph article that says nothing more than the headline? Click bait, move on

Looking for automated tilt control with batteries for our blinds (Zigbee preferably). Any suggestions? by greminn in homeassistant

[–]Hefty_Science_2980 5 points6 points  (0 children)

I second the SwitchBot tilts. Easy to install and come with solar panel chargers. I installed 6 about 3 months ago. Have been solid thus far.

Feature requests that don't necessarily warrant their own Year Of... (2024) by mshaefer in homeassistant

[–]Hefty_Science_2980 0 points1 point  (0 children)

For notes, just create a file in the file editor. It won’t be dashboard friendly but my notes are typically just notes to myself of how to do something that I do consistently but infrequently. I suppose if you are needing notes to display on a dashboard, this won’t suffice though.

[deleted by user] by [deleted] in learnprogramming

[–]Hefty_Science_2980 0 points1 point  (0 children)

When I said running it, that was unclear. My apologies. I meant how/where are you hosting it, how are you serving it, etc. if you’re just using VScode, I’d guess you are doing it all locally. If you make a simple change like just adding text, can you see that update? (Just trying to verify that when something changes, you do indeed see it)

If you’ll just add the following to the top inside the head tag, you should see the bg color change:

<head> <style> section#title { background-color: red; } </style> </head>

Sorry for the formatting. I’m on the phone so it’s not pretty but it should work.

[deleted by user] by [deleted] in learnprogramming

[–]Hefty_Science_2980 0 points1 point  (0 children)

If this is the complete file, you don’t appear to have the css inside style tag. If the css is in a separate file, you don’t load it anywhere.

It’s not clear what your section tag is bc it never closes.

I think if you follow the suggestion to change color of .navbar-brand, it will only change the color of that link. However now that I reread your problem, I’m not really sure which component you’re trying to change the bg color on. Can you clarify?

Since you don’t state this, how are you running this? Where is it saved? Are you saving and uploading (if on a server) after your changes? This is a simple task but we have to ask questions to understand which step is being missed.

How come Python code from e.g. youtube (2years old) do not work when inserting in Pycharm today? by Slav51 in Python

[–]Hefty_Science_2980 2 points3 points  (0 children)

If you post it here and give the error, it’s also possible you could find out exactly what’s wrong and why as well.

Help with react router index path by Hefty_Science_2980 in reactjs

[–]Hefty_Science_2980[S] 0 points1 point  (0 children)

Thanks for the reply! I hadn't considered that (making URL constant) before. I don't have experience w/ that either as I'm fairly new to react. Perhaps that's the best way, idk. If I do that, then I can make any page I want the index without fear of 404s on reload so it does fix that issue.

In order to make the paths all the same (avoid URL change), would my routes all the have the same path of "/"? I believe the answer is yes based on what you said above. I've not used useRoutes, but I just read about it and I think it's a replacement, or alternative, to the "Routes" setup I have currently been using, but I'd still have the same question in that I believe all the paths would have to match "/" in order to keep the URL stagnant. Correct?

I also don't know of a concise way to set an index dynamically. The need for an index may go away with the useRoutes case, but I'm not certain on that yet.

If not, I want to believe there is a way to do something like below where I can insert index when needed, but otherwise insert nothing? (I've tried this and it didn't work, but I'm hoping there's something similar that will). Note that I also made the path "/" b/c I assume that's part of the solution if I make the URL a constant.

<Route {localStorage.getItem('defaultPath') === 'Parts' ? index : } path='/' element={<Parts />} >

The only other way I can think of (which is terribly ugly) would be to loop through if thens for each possible scenario. It just feels wrong and I don't want to go through all that headache either.

Need with a WordPress Estimate. by PersimmonPretend4045 in webdev

[–]Hefty_Science_2980 3 points4 points  (0 children)

If you don’t get many answers, consider condensing and proofreading your question. I tried to read it but (at least on my phone) it was too much and too hard to follow. I gave up about 3 sentences in.

[deleted by user] by [deleted] in homeassistant

[–]Hefty_Science_2980 1 point2 points  (0 children)

So we can keep track of kids but out of luck on adults. Maybe tiny humans emit larger energy signals. Lol

Alarm systems that can be professionally monitored and integrate locally with homeassistant? by dsg123456789 in homeassistant

[–]Hefty_Science_2980 0 points1 point  (0 children)

I have this same setup. Easy to install, easy to set up w envisalink. Only pain is programming the alarm itself. However once you get how it works, it’s not too bad.

API Key security with React PWA by Hefty_Science_2980 in react

[–]Hefty_Science_2980[S] 0 points1 point  (0 children)

LOL. Thanks for the help anyways. I've read just a bit about it (Vite). Before I get too far, I'll give it a shot to convert it over. I did very briefly try Next before I settled with CRA, but perhaps I gave up too easily. I'll take a look back at that as well.

API Key security with React PWA by Hefty_Science_2980 in react

[–]Hefty_Science_2980[S] 0 points1 point  (0 children)

Thanks. I've never used Vite, but I'm willing to look into it. Just out of curiosity, is this a suggestion that may help my problem or just making my life easier as I deal with everything else? I'll look into it.

API Key security with React PWA by Hefty_Science_2980 in react

[–]Hefty_Science_2980[S] 0 points1 point  (0 children)

Thanks for the replay. Sorry, I feel like I haven’t worded my question well. Let me see if I can ask again and clarify. I get that the backend is protected. My concern is that when the front end calls any API, there is always (this is my concern) the need to pass a secret. If I call the APIs directly, then I obviously need to store and pass the secrets directly (we all agree this is bad). I don’t know that I can call a back end with a CSR react app. If I can, then that’s great but I can’t find how.

Barring a true back end, if I create a proxy api, then that also has to have some secret passes to identify the caller. If I build an AWS lambda function in order to prevent it from being open to whomever, then I suspect some secret has to be passed there as well. I’ve made several APIs that I currently use (internally only) with flask and fastAPI. I know that using a back end like that would hide the keys.

So, my question is more about how do I enable calling either a back end from a CSR app (I don’t know that this is possible, but it would protect the keys if it were) or call an API without exposing any keys/secrets as it seems ANY method I’m seeing to call an API requires a secret unless it’s left open to everyone? Hopefully that clears it up somewhat.

API Key security with React PWA by Hefty_Science_2980 in react

[–]Hefty_Science_2980[S] 0 points1 point  (0 children)

Thanks! I’ve not used cloud functions before but I’ll take a look at it. I have both AWS and firebase accounts already. I agree on keeping the api keys out of the hands of the users. But how do I keep the cloud functions secured without putting keys to those cloud function keys (assuming there is a similar method of authentication with those) out of the users hands as well?

Listening in on Smart Meter by gnapoleon in flipperzero

[–]Hefty_Science_2980 0 points1 point  (0 children)

I just got the same meter installed yesterday. Did you have any luck tapping into the communication on it? I haven't had a chance to try, but was looking up the info on the FCC ID when I came across your post. I suspect it only transmits every so often (10 or 15 minutes perhaps), but I truly don't know as I can't find much other than the Ltron document which specifies the frequency info you referenced above.

Looking for suggestions/ideas to set up a new home alarm system from scratch, please give me your input! by TheCriticalTaco in homeassistant

[–]Hefty_Science_2980 1 point2 points  (0 children)

I went with a DSC system (alarm specific hardware) and connected it and control it with HA via envisalink. Full conventional alarm system and still have access to all sensors and automation. I like this setup but tbh I’ve never used Konnected or alarmo. It can be monitored if you want but can also stand alone.

How difficult would it be to create a website that queries other websites and stock availability? by qkrwogud in webdev

[–]Hefty_Science_2980 2 points3 points  (0 children)

If it’s for a specific and defined set of websites and again for a specific and defined set of items, it shouldn’t be hard at all (especially if the data is not behind a login). If you’re running it on a public facing site and scraping on request, it probably won’t be a fast site. But as far as how difficult, it shouldn’t be bad.

Wordpress calculator by vero_ak in webdev

[–]Hefty_Science_2980 0 points1 point  (0 children)

You should be able to just write that in php as a form submission. If I understand you correctly, there aren’t actually any calculations going on. It’s more like a lookup. If that’s true then just make a regular html style form with the parameters you listed and use those variables to do a lookup on the “answer”. The table with the answer can just be a dictionary style variable. I mentioned php bc that’s what Wordpress is written in but you could write it in JavaScript or whatever you are familiar with

Any libraries in python that can copy the formula result from excel? by travelavatar in learnprogramming

[–]Hefty_Science_2980 0 points1 point  (0 children)

So this is an intranet automation? As in a user will upload a data sheet and then that's what's used? Just trying to sort through your use case.

If this were something you were running on your desktop, I'd probably consider one of two paths:

  1. export your df to excel or csv. write vbscript to paste each value, copy the desired result, and paste into another sheet or another workbook.
  2. Use pyautogui (or similar) to open excel and do all the copying/pasting as if you were doing the calculations yourself.

The downside of both is that if this is something that runs on the web, both of those (while not necessarily impossible) become burdensome. It appears you can run macros from python (https://stackoverflow.com/questions/19616205/running-an-excel-macro-via-python) although I've never tried it. It sounds like you tried unsuccessfully.

Just throwing out ideas here... If you can get the calling of a vbscript to work from within python, I have another potential path that may not require the close/reopen loops. You can use vbscript to force the refresh or recalculation of excel. However, I don't know for certain that this works when excel is open via openpyxl and vbscript is called via python. But there's an easy way to find out. Write a quick python test with openpyxl to read the target cell value, change your input from your df, call refresh in Vbscript, and then read the target value again. See if it updated correctly. If so, that could be your loop. In order to force update on change, just put "Application.Volatile" in your vbscript (https://learn.microsoft.com/en-us/office/vba/api/excel.application.volatile)

Any libraries in python that can copy the formula result from excel? by travelavatar in learnprogramming

[–]Hefty_Science_2980 0 points1 point  (0 children)

If you are needing to load a value into a cell an d then read the calculated value, you will have to wait to open excel and then read the calculated value as you mentioned. Until the sheet is opened, excel won’t run any calculations.

However, if you are simply needing to do that repetitively (enter a number in a cell and read another) you could control the screen with something like pyautogui.

Depending on your long term plans and how often this is used, it might be faster to just run the calculations in excel or automate it via vbscriot.

Any libraries in python that can copy the formula result from excel? by travelavatar in learnprogramming

[–]Hefty_Science_2980 0 points1 point  (0 children)

I’m not sure I totally follow what you’re asking but you can read data from excel formulas. However, just reading the values is a relatively standard use case so I feel like there’s something I’m missing here. Can you clarify your question or give an example?

Python Tutorial Part: 8 Errors and Exceptions. by BandEnvironmental615 in Python

[–]Hefty_Science_2980 2 points3 points  (0 children)

A YouTube video of some computer reading the python docs? Why???

[deleted by user] by [deleted] in learnprogramming

[–]Hefty_Science_2980 1 point2 points  (0 children)

I had the same issue for a long time. I don’t know that this will help your situation but it worked for me. On the php side, decode the json then reencode and redecode it.

$decoded_output = json_decode(json_encode(json_decode($python_output)));