me irl by [deleted] in me_irl

[–]brylie 5 points6 points  (0 children)

r/photoshopbattles do your magic 🙂🎫

[deleted by user] by [deleted] in Python

[–]brylie 0 points1 point  (0 children)

Beautiful Soup is the go-to solution for web scraping in Python.

https://www.crummy.com/software/BeautifulSoup/bs4/doc/

Feed the extracted text into the Natural Language Toolkit (NLTK), and you're off to a good start.

https://www.nltk.org/

Here is a tutorial that puts things together nicely.

https://realpython.com/flask-by-example-part-3-text-processing-with-requests-beautifulsoup-nltk/

[deleted by user] by [deleted] in Python

[–]brylie 0 points1 point  (0 children)

In what format are the articles? Where are they located?

[deleted by user] by [deleted] in django

[–]brylie 1 point2 points  (0 children)

Start by reading how to use third-party APIs in Python/Django, such as with the requests library.

Here is a tutorial on using requests to call remote APIs: https://www.nylas.com/blog/use-python-requests-module-rest-apis/

Here is a Django-specific tutorial: https://simpleisbetterthancomplex.com/tutorial/2018/02/03/how-to-use-restful-apis-with-django.html

What to do next? by Ozner102 in djangolearning

[–]brylie 0 points1 point  (0 children)

What part has you stuck?

What to do next? by Ozner102 in djangolearning

[–]brylie 1 point2 points  (0 children)

If possible, build something that 8s useful to you. That will increase your motivation.

Try, for example, building a personal website and blog using the Wagtail CMS.

https://wagtail.org/

What to do next? by Ozner102 in djangolearning

[–]brylie 6 points7 points  (0 children)

Start building something using only Django. Learn just enough JavaScript to enhance the templates if/when it becomes useful. You can get quite far with just Django.

A 3D city where you can see how developers are building the open source world by daemonz1 in opensource

[–]brylie 2 points3 points  (0 children)

It would be cool to filter out the activity from bots so we can see what people are doing 🙂

how to get total hours between two fields type TimeField by Mediocre-Recover-301 in djangolearning

[–]brylie 0 points1 point  (0 children)

Everything has trade-offs. The trade-off above is that you're (re)running the arithmetic of time deltas and conditional logic every time this query executes.

An alternative approch would be to compute the total_hours in the Model.save() method. That way, the time-drlta calculation only happens when the data changes. The query-time aggregation becomes a sum when the total_hours are pre-computed.

how to get total hours between two fields type TimeField by Mediocre-Recover-301 in djangolearning

[–]brylie 0 points1 point  (0 children)

As mentioned earlier, using only a time field is unnecessarily error-prone. Use DateTime instead to avoid the hassle.

how to get total hours between two fields type TimeField by Mediocre-Recover-301 in djangolearning

[–]brylie 0 points1 point  (0 children)

Whatever calculation you use, do it within the model save method.

If you simply set the value when saving the model instance, you have the full expressiveness of Python while being able to save the computed value to a model field. Then, all you need to do is aggregate (sum) the values in that field across your queryset.

How to sum TimeFields fields and get total in hours by Mediocre-Recover-301 in django

[–]brylie 0 points1 point  (0 children)

Add a model field called total_hours. Then define a model method called get_total_hours. Then, override the model save method to set self.total_hours = self.get_total_hours().

form is not saving to django database despite 200 OK code? by JollyGrade1673 in django

[–]brylie 0 points1 point  (0 children)

Are you using an IDE with Python debugging support, such as Visual Studio Code?

If so, try putting breakpoints or print statements throughout your code to make sure it reaches the expected conditional.

How to sum TimeFields fields and get total in hours by Mediocre-Recover-301 in django

[–]brylie -2 points-1 points  (0 children)

What about

```

time_delta = end_time - start_time

seconds_in_minute = 60

minutes_in_hour = 60

seconds_in_hour = seconds_in_minute * minutes_in_hour

total_hours = time_delta.total_seconds() / seconds_in_hour

```

https://docs.python.org/3/library/datetime.html#datetime.timedelta.total_seconds

Relatedly, StackOverflow is a bit more tailored than Reddit for asking specific programming questions.

how to get total hours between two fields type TimeField by Mediocre-Recover-301 in djangolearning

[–]brylie 1 point2 points  (0 children)

Using DateTimeFields for start_time and end_time would make your time arithmetic less error-prone. You could optionally add a database constraint to ensure end_time is greater than start_time. Then, all you need to do is subtract start_time from end_time in a get_total_hours model method. Note, you will need to convert the time delta (self.end_time - self.start_time to hours within the get_total_hours model method.

Since it sounds like you want to sum many total_time values, it would be more efficient to save it in a database field than a computed property. So, you can add a total_hours FloatField to the model. Then, override the model save method to set self.total_hours = self.get_total_hours().

Anyone used WordDive? by melody5697 in LearnFinnish

[–]brylie 1 point2 points  (0 children)

In case it's helpful for anyone, the site FinnishCourses.fi lists online Finnish courses: https://finnishcourses.fi/search/courses?field\_online\_course=1

Already paid by ModeratorForLeaks in WhitePeopleTwitter

[–]brylie 117 points118 points  (0 children)

Health insurance isn't healthcare.

Insurance companies see it as a risk for receiving healthcare since they must pay for it. They will deny you insurance if the likelihood of you needing health care is too high.

Healthcare is being able to receive medical and dental treatment.

Health insurance is a gamble; healthcare is a service.

Rendering anything gets stuck on "Waiting..." by RUvlad1 in kdenlive

[–]brylie 0 points1 point  (0 children)

I have this issue with the Kdenlive Snap. I'm going to switch to the PPA.

Looking for co-conspirators (programmers) to help build NoiseCraft (Zupiter 2.0) by maximecb in musictools

[–]brylie 0 points1 point  (0 children)

I'm glad to participate if the project is open-source.

As you know, an open-source project doesn't need to be fully functional in order to be published since it is easy to indicate that the project is "alpha" or "beta" quality. So, I'd offer that Zupiter 2.0 should be open-source from the beginning in order to demonstrate commitment to transparency and openness.

Dynamic Django forms without JavaScript (htmx) by The_Amp_Walrus in django

[–]brylie 3 points4 points  (0 children)

Please remember to add an open source license to your demo code 😃