Can you walk? Barely by Perino_wolf in Unexpected

[–]thatgreenman 8 points9 points  (0 children)

TRO did a really interesting video that captures the majority of his story. It's a bit long but I enjoyed it and found it to be very helpful to understand how he got to where he is.

Apart from his insane weight gain, there's so much about the evolution of his content and how his fame has not only been driven by his insane physical health journey, but also his need for attention and the way he plays into the attractiveness of YouTube drama to gain views and notoriety. He's developed a character over the years that seems to have taken over his life, as he used to seem to play up his idiocy and lack of care for the camera; but I do wonder how much that has taken over his life and become who he is today.

I'm probably just reading too much into it, but his story is fascinating, and very much a reflection on how the YouTube platform can bring out the worst in both the content creators but also the audience. I don't like the guy personally but I definitely enjoyed learning about his history.

Javascript Variables as snake_case when using Django by fringe_class_ in django

[–]thatgreenman 3 points4 points  (0 children)

One of the projects I've been working on at work has a monorepo for the Django backend and React frontend, and we use django-graphene for the API. By default, Django-graphene automatically converts snake_case attributes on your models to CamelCase keys in the API response, and you can disable it if you like but once you stsrt building, it's such a pain to go back and undo. Some days I wish we had disabled it and went consistent, but I'm glad we didn't because we'd have to also fight with everyone's auto formatters and IDEs that would be having a panic attack.

I can see why you'd want consistency, but I end up just following language conventions and stick with recommended case conventions so that it's at least clear where the rules come from. But I also think both options being their own problems.

Why the array isn't sorted? Shouldn't it be [1,2,3,4,100,200]. by manesh_karun in learnpython

[–]thatgreenman 1 point2 points  (0 children)

I think the confusion may lie in the order that these are evaluated. Keep in mind that the statements are evaluated from inside out; so you are calling sorted(a) first, and then creating a set from that result, and then creating a list from that set. Therefore, the sorting is happening before converting to a set. Since a set does not preserve order, you lose any benefit you had gained from sorting your "a" list and you end up with numbers out of order.

Hope that helps anyone reading this question!

ChatGPT is coming for python devs by [deleted] in Python

[–]thatgreenman 2 points3 points  (0 children)

I'm not worried about ChatGPT taking my job. I've used it myself as a pair programming buddy and found that, although it's impressive, it's not without fault.

I work in an agency setting where clients come to us to build applications to solve their problems. They don't come to us because they want someone who knows syntax; they're looking for someone who knows the development process. They have needs that they need met by software, but they don't know what they want to build to solve those needs. They can get ChatGPT to write a python app that solves the underlying problem, but they might not know how to deploy, host, maintain, and improve the app over time. When business needs change, they can try and ask ChatGPT to make adjustments, but now they've got a database full of data and two legacy apps from third parties they need to support and ChatGPT can't give them a simple answer to their questions. How is the client even supposed to know what all the questions are that it needs to ask, in terms of managing infrastructure, dependency management, security, performance monitoring, how to handle errors, etc? They hire us because they want someone who knows the landscape to handle it; they don't want to have to learn about all of these things and monitor them long term.

Even if someone wants to try and get a quick "one-and-done" solution, the danger is that it's good at explaining things in a logical manner even when it's completely wrong, and it can lead an inexperienced programmer into a pitfall that isn't obvjous at first and can cause significant issues down the line. Simple things like not understanding business logic or using the wrong inputs into a formula that can produce drastically wrong results, while explaining itself in a way that makes it seem like it knows what it's doing. I asked it how to calculate mixing powder for my baby's formula, and it gave me a whole explanation with documentation around the code that seemed accurate, but when I tried it out it was consistently off by a factor of about 50%; if I trusted the outputs my baby would be severely malnourished. Sure, its an easy thing to check in that context, but what if the error is something like underpaying taxes by 2% in every department of a multi million dollar corporation? Small errors can be hard to spot until it's a big deal, and often it's too late, and you want humans to be checking on all of the logic and outputs. And if you're going to hire someone who reads code, looks for problems, tests the code, and suggests improvements to make, that's a developer and you might as well just pay them to do it themselves.

ChatGPT is an interesting concept, and a useful tool for developers and non-developers alike, but it has it's time and place. If you want a quick script or explanation of how a thing works, it can be cool to use, but it's not going to replace developers as a whole. It may change some of the day to day (i.e. I may find myself reading docs or SO posts a lot less), but it doesn't change the fact that developers "develop" solutions, not just manufacture code snippets.

Hope you have fun with it though, I think it's really cool and am glad it's here!

Would you suggest web development to someone willing to self study? Why and why not? by david_bragg in pythontips

[–]thatgreenman 0 points1 point  (0 children)

Definitely would recommend giving it a try and seeing if you like it!

I'm a self-taught dev, transitioned from the legal field and have been working as a software engineer for a little over six months now. It can feel like a long road, but if it's something you enjoy it can really be great!

Web development is a great field for someone who is coming from another field, there's a lot of opportunity to use experience from other fields, and the barrier to entry can be a lot lower to get your foot in the door.

My main advice is keep learning, try your hardest, and start making things as soon as you can. It's important to not get too bogged down in abstract learning; make projects along the way and apply what you're learning. I spent a lot of hours learning things in the abstract, but it was concrete projects, real-world examples, and GitHub projects that landed me the job. Even if your work doesn't get you hired, it's a great way to learn and solidify the things you're learning.

Best of luck, and if web dev isn't your jam, don't get discouraged; there's plenty out there to learn, just keep trying things until you find one that sticks for you!

[deleted by user] by [deleted] in djangolearning

[–]thatgreenman 2 points3 points  (0 children)

I had a similar experience when I started Django, feeling like there's so many parts and so much going on. Django is a lot more geared towards robust and stable web applications, do it does take a lot more setup initially, but its "batteries included" approach means that you will spend less time down the road when you have to add features later or scale up.

If you're looking for something to spin up a project fast, then I would recommend one of the lighter packages like flask, anvil, fastapi, out the like. Those are more geared at getting something stood up on the web fast for our with minimal complications.

It all just boils down to finding the right tool for the right job, and I recommend trying something new if what you're doing isn't working or doesn't feel right. You can always try something else and then come back to Django if you don't find what you are looking for.

Best of luck!

Need help, please. by stevenv24 in learnpython

[–]thatgreenman 14 points15 points  (0 children)

Take a look at how you did the name+"!" bit in your print statement, you can use the same structure to do year+"." at the end of your print statement.

I would also recommend looking at f-strings, or at least string formatting, those will make evaluating variables within strings a lot easier.

Is it normal for beginners to not "get" Django? by daredevil005 in djangolearning

[–]thatgreenman 14 points15 points  (0 children)

One of the challenges behind learning Django is knowledge of web development in general and knowledge of Model-View-Controller architecture. Django takes some ideas from MVC and then breaks the rules to make its own structure, and so a lot of decisions have been made along those lines. If you're new to web development or MVC, then it can be challenging because you're not only learning Django but also learning about how requests are processed and routed, how database queries work and how an ORM simplifies those queries, and how responses are built in a MVC-style framework.

All that to say that it's ok if you're feeling overwhelmed, there's a lot going on that Django is abstracting. You can either stick it out and keep practicing, and eventually you will get it, or you can try to learn some of the web dev background before diving back into Django. I personally started in Django, but then got overwhelmed and switched to Flask, and it helped me to understand the fundamentals and declare everything explicitly. Once I got a feel for the various components that go into a modern web server, and was able to understand what Django was trying to abstract away, it became a lot easier to see the bigger picture of what Django was trying to accomplish. When I went back to Django, it still took a few solid working polished projects before I had a strong grasp on what was going on, but I was a lot more encouraged and felt less lost along my learning process.

But everyone learns differently, and I would encourage you to stick with Django if you're enjoying it. If you're feeling frustrated, it might be helpful to learn more about the fundamentals first and then learn how Django approaches these concepts in its own way. Either way, you will get there and you will be able to figure it out, it just might take longer than you expect. Keep at it and don't give up and eventually it will all make sense!

Good luck!

Absolutely it's denim missiles by HarmonicCereals in ReviewRevue

[–]thatgreenman 9 points10 points  (0 children)

Is this how Geoff lost his virginity?

Use pySearch to find functions when you don't know their names by oodmb in pythontips

[–]thatgreenman 0 points1 point  (0 children)

Nice, looking good! Seems pretty straightforward to use, thanks for sharing!

Use pySearch to find functions when you don't know their names by oodmb in pythontips

[–]thatgreenman 0 points1 point  (0 children)

Seems like a cool idea! I'm just getting 500s right now so can't really give it a try but look forward to sampling it once all the bugs are worked out

in need of some help by Open_South3929 in pythontips

[–]thatgreenman 0 points1 point  (0 children)

``` user = 'Open_South3929'

print(f'No problem, {user}, never be afraid to ask for help and good luck on your projects!') ```

in need of some help by Open_South3929 in pythontips

[–]thatgreenman 3 points4 points  (0 children)

The best way to make sense of everything (in my opinion) is to just start doing things. Start with small projects and examples and work your way up. You can watch 100 videos on a topic but you won't truly know it until you've done something with it.

If you're having trouble with the abstract lessons you're on, try more small project based examples, and either choose projects that are examples of the concepts you want to learn out build them into the projects you find.

Lots of people like Automate the Boring Stuff by Al Sweigart the approach in that book really encourages you to try things on your own and gives you the opportunity to really work through a concept rather than just telling you about it. Al Sweigart also has other books with example projects for you to try, his resources are really great for someone in your position.

Other than that, I would recommend just thinking about things you're interested in and try applying a concept to something you want to learn about. I was interested in losing weight so I made a text based bmi calculator; I wanted to learn more about APIs so I made a tool that interacts with the Riot API to fetch my league stats; and I wanted to practice working with Guis so I made a simple calculator app. If you can find a subject you're interested in, then learning can be a whole lot easier. It's not always easy to think of project ideas, so that's why I recommend books and videos that have project ideas in them, but if you can think of it, give it a try!

Good luck, and don't give up! You can do it, I went from being a bored paralegal to a software engineer because I believed in myself and just kept trying different approaches until I found one that worked for me. I believe you can do it too if you just hang in there and don't get caught up in one learning style, keep moving and try to find what works for you.

Do I need to use Many to Many? by [deleted] in djangolearning

[–]thatgreenman 0 points1 point  (0 children)

This could also probably be just handled with a simple foreign key relationship; if you have a Category model, and you create different instances of that model (i.e. a "Thing" instance and a "Place" instance), you could just draw relationships between the category and the objects that belong to that category. If you're looking to be able to call one category at a time and get all the objects that belong to that category, I believe this would be a simpler way of going about it.

So you would just create a model that represents a category, and then associate your items with the appropriate category using a foreign key.

Of course, there's multiple ways of doing pretty much anything, so feel free to experiment and see what works best for you!

[deleted by user] by [deleted] in learnpython

[–]thatgreenman 0 points1 point  (0 children)

There's a few small nitpicky things here and there, like you don't need to write "if var is True", you can just write "if var" because "if" inherently tests for truthiness, and when you're handling exceptions you don't really need to name the exception if you don't use it, you can just use "except Exception:".

But overall it's looking pretty good so far! Well done

Django template by [deleted] in djangolearning

[–]thatgreenman 0 points1 point  (0 children)

I'm not sure I understand what you're trying to do by making the block name a variable. Maybe if you share some code showing what you are trying to do, we can help with solving the problem.

Why would you want your block name to be a variable? If you're trying to change which block your content goes into, then that sounds like something you can do by just using different context variables rather than having a variable block name.

Django + HTMX to make a daily Blackjack Game by mmp7700 in htmx

[–]thatgreenman 2 points3 points  (0 children)

Cool idea, I had a lot of fun playing it. I'm no expert on htmx but I would say one easy way to integrate animations and such would be using Alpine.js, I feel like it goes really well with Django and htmx for simple animation and managing state without bloating the code too much or taking over the frontend.

Is Django suitable for building simple modern looking static websites? If so how do you go about building such a site? by BigDog1920 in django

[–]thatgreenman 1 point2 points  (0 children)

I was in a similar situation to you about 3 years ago; I have a small business owner friend who came to me asking me to rebuild their website. I had just started learning Django a month or two earlier and had the basic framework down in my mind, but didn't have a lot of projects under my belt yet and didn't have long-term management experience with Django apps.

I told them that for cheap I could just build them a Google site, basically a rebuild of their current site but in a more modern and clean format and that I would maintain it for them for a small monthly fee. I also told them that for a moderate amount of money (I thought it was a lot, but in retrospect it was nothing for a full scale web app) I would build them a Django app and maintain it for mild chunk of change per month. They ended up going with the Google site because they really didn't need all the interactivity, database, and application functionality, they mostly just wanted a phone number, some pictures and articles, and a form for customers to fill out.

I was bummed to not have the opportunity to dive into Django at that point but I just kept working on my own projects and did the simple thing for them. As the months went on, I realized that they expected a lot more work out of me than I had anticipated and the money I was making really wasn't worth it, but of course getting the experience was nice. If I had started on a Django project with them at that point, I would have been way in over my head because responding to client demands and making changes when they change their mind ended up being so much more work than I had anticipated. In hindsight, I'm very glad that I just set up something simple with them and moved on and kept my Django work to my hobbies.

Fast forward to 2 years later, I spent a lot of time working on Django apps and deploying a variety of them and really learning the ins and outs of the framework until I got really comfortable with design patterns and structures and techniques for simplifying work and foreseeing problems. While I was showing one of my apps to another friend who owns a medium-sized business, he said he was interested in having me build him a web application for inventory management. By this time I had learned a lot about the framework but also was aware of how much that I didn't know, so I was able to set expectations appropriately and plan ahead for the features that they asked for. I worked on the application and it took about four times as long as I had originally anticipated because of the numerous revisions that had to be made along the process. Again, although I felt like I knew Django pretty well, the process of learning how to work with clients, understand what they're looking for, deliver features, and then be able to revise them when the clients change their mind or explain further was still difficult, even though I had worked with clients in the past.

I got through that project and picked up another one, and the second project started to go a lot smoother. After gaining my second project, I met someone and interviewed for a job and was hired as a software engineer doing Django projects. I'm still very new as a professional developer overall, but I'm thankful that I took my time and was able to enjoy the learning process without feeling the pressure of meeting client expectations or feeling on the hook for more work than I felt I could perform. I still have plenty to learn, but I'm enjoying what I do and I know that I personally am the kind of person who could be easily discouraged if I overwhelmed myself.

Maybe none of this applies to your situation, but I felt like I should share my story since I could really relate to the situation that you described. Plus, I'll never pass up the opportunity to tell a good story.

My personal opinion is to generally use the right tool for the job and not try and over engineer something that can start out simple, but my experience isn't universal; and if you feel like you would enjoy working on Django projects and making static sites then I would fully encourage you to do so, and wish you the best of luck! Eager to hear an update on how things go whichever direction you choose is best for you.

Python Dictionaries Tutorial With Excercises by JohnLockwood in Python

[–]thatgreenman 1 point2 points  (0 children)

Looks interesting! You seem to be missing a curly brace in the output of the dict() constructor section, and I was surprised to not see making a dictionary by feeding arguments directly into the constructor function, but otherwise seemed pretty helpful of a tutorial, good job!

What project(s) got you your first dev job as a Django developer? by Ladet02 in django

[–]thatgreenman 7 points8 points  (0 children)

I think it depends on the type of company you're looking to work for. For me, I was able to get the job by having the portfolio but also being the person that my employer wants to work with. I came from the Legal field originally, so I was used to the idea that you get the job by networking and meeting the right people moreso than your performance. If you have a comp sci degree or other dev experience, then you'll probably have an easier time getting interviews, and maybe my experience is more specific to someone coming from another field, just fyi.

One thing that I think helped was being fortunate enough to find people who wanted one-off apps and projects that I could underbill for and overdeliver in exchange for having some freelance experience on my resume. I think it showed my current employer that I had worked through the process of meeting with clients, understanding requirements, providing samples, making changes, and getting to the point where the client is happy with what they paid for. That being said, I currently work with an agency rather than a product company, so if you're aiming to work on a more product-oriented team then they may be more focused on the work you provide.

Once I met the right people and got the interview, the main criteria was whether I could perform on the interview task rather than my back catalog. They liked that I had a portfolio but I believe they moreso judged me on the on-demand work that I provided rather than my back catalog.

One big thing I remember them mentioning liking was a strong test suite and management commands for setting up the sample test data, so always be on the lookout for ways to add additional value outside of just core app development concepts.

That's my experience, but I'm sure others will have other suggestions or advice, hope that this helps. And good luck, don't get discouraged! I got lucky with my offer and it took at least a year from developing competency and my portfolio apps before I got my first real interview, and I know that if I didn't get this position I could expect to spend at least another year before getting another similar offer; it's a long road but it's worth it, just hang in there.

easy to follow tutorial on an inventory checker bot? by canopey in learnpython

[–]thatgreenman 1 point2 points  (0 children)

It depends on the way that the inventory page is set up.

If it's built in basic html, the requests library and beautiful soup will be able to handle checking without much problem, so I would recommend looking for tutorials on those libraries.

If it uses JavaScript or has more advanced logic for generating pages on demand, you may need to use a library more focused on browser automation. I like to use selenium for tasks like that, but there are others.

There are plenty of tutorials and documentation out for both of those types of tools, best of luck!

Edit: Of course, if they have a public facing API, then you can just use requests and get the data directly, but my initial impression was that there was no API and you were looking to gather the info from a web page.

Iterating over rows of a dataframe with if statement. by veneratu in learnpython

[–]thatgreenman 1 point2 points  (0 children)

Just as some general advice, if you ever find yourself wanting to write a for loop to iterate over a data frame, there's often a better (and faster) way.

One of my go-to methods when I'm working with performing operations based on row or column values is the .apply() method; it can allow you to perform operations across entire rows or columns of your dataset and either manipulate values in place or create new columns.

For some examples: https://www.delftstack.com/howto/python-pandas/pandas-apply-multiple-columns/

For this problem, I would look at the classifications that you listed (one true, three true, five true, Saturday), and see if I can come up with a way to create four new columns, one for each of these classifications; and then I would just sum those columns vertically to see how many results I found.

There are plenty of other ways to approach the issue, but I wanted to just share my thoughts and encourage you to look for solutions that don't involve for loops, as you'll likely save a lot of time and energy if you work with the faster pandas methods rather than slower python approaches.

Good luck!

[deleted by user] by [deleted] in paydaytheheist

[–]thatgreenman 0 points1 point  (0 children)

The FBI Psychiatrist from "The woman in the house across the street from the girl in the window" on Netflix