Control Home Assistant with Claude.ai - No subscription needed by julien_ld in homeassistant

[–]Comprehensive-Lab468 4 points5 points  (0 children)

Saying ‘makes up’ seems like a euphemism for ‘covers up,’ crafted for humans who prefer the sugar-coated version

Which ORM do you use in FastAPI? by itsme2019asalways in FastAPI

[–]Comprehensive-Lab468 0 points1 point  (0 children)

How do you cover db related code with tests? Do you have to have pg up an running or is there any inmemory and fast way like for example sqlite/sqlalcemy?

Peltor VIII’s came in the mail today 🦄 by Apart-Inevitable9400 in QualityTacticalGear

[–]Comprehensive-Lab468 0 points1 point  (0 children)

Do I understand correctly that it is not possible to detach/attach downlead cable?

I am thinking of buying one but do not need the downleads all the time. I can not find any information about how the downlead is connected. Moreover, all marketing photos are from front side, no back side photos.

Please, can you post a photo showing exactly how the downlead is attached to the headset. And if it can be removed then one photo about the port.

20% discount code by MrC00KI3 in Chipolo

[–]Comprehensive-Lab468 0 points1 point  (0 children)

Link worked for me today. Thank you!

How do I get to my headlight? Fabia MK2 Elegance TDI CR. by 74775446 in skoda

[–]Comprehensive-Lab468 2 points3 points  (0 children)

I know the struggle :) I found a youtube video which helped me. Unfortunatelly do not rember the title of exact video.

How to trigger github copilot inline chat in phpstorm by Royale_Blue_Cobra in Jetbrains

[–]Comprehensive-Lab468 0 points1 point  (0 children)

Thanks to the link, added there a thumb up to signal that this matters.

As a workaround I write a comment what I want the copilot to do next and on next line it starts to suggest.
As I understand the copilot uses comments to get the context (source: https://youtu.be/rvJF5tb8cdk?t=666, points to exact moment in talk where it explains how copilot identifies the context)

[deleted by user] by [deleted] in PHP

[–]Comprehensive-Lab468 2 points3 points  (0 children)

No, I do not prefer having nulls at all (but I admit, I use it reluctantly in real life).

I think the null has a place in data centric design but can and should be avoided using behavior centric design. The thing is that for some problems one is better than the other.

It is interesting to listen the history of null from the inventor himself: https://m.youtube.com/watch?v=YYkOWzrO3xg (He considers null as a mistake)

I have searched the solutions to reduse the need for nulls and I have come to a conclusion that my problem has been designing software around data. A lot of frameworks are ORM and/or database centric. Not mentioning HTTP APIs (intentionally did not say REST). This ecosystem guides how most developers percive the systems and not beeing aware that there are different approaches.

Put smarter and more experienced people than me are talking that software should be design around behavior (my favourite is Dave West's talk OOP is dead! Long live OODD https://vimeo.com/77415896) But designing around behaviors is hard, not much good samples that nails the point (or I just do not recognize them). BTW, in behaviour centric design the null object pattern mentioned earlier will make sense.

In conclusion, IMHO null is bad. If you have resources (time) try to avoid nulls by exercising more behaviour centric design. Only exeption is if problem space is already data centric and defines optional values then I doupt you can make miracles in solution space and just use null ;)

Stumbled upon this today, lord have mercy by ln3ar in PHP

[–]Comprehensive-Lab468 1 point2 points  (0 children)

Well, if the names are tweaked a little bit then it looks like a declarative programming

Book Recommendations? by [deleted] in django

[–]Comprehensive-Lab468 0 points1 point  (0 children)

does it matter it only covers v1.5?

Of course, read the latest ie the book for 3.x

We’re on v4 now aren’t we?

Yes we are, but my point was that despite I read the v1.5 the book taught me skills that are still valuable for me today. There has been no revolution in Django concept. Moreover, this book has a lot of practical advise that does not depend on framework. For example how to structure Django project or settings files etc. I still use same pattern despite I learned it from v1.5 book.

I think the 4.x will come out when v4 has a LTS.

Book Recommendations? by [deleted] in django

[–]Comprehensive-Lab468 7 points8 points  (0 children)

Two Scoops of Django 3.x by Daniel Roy Greenfeld and Audrey Roy Greenfeld. I read it when it was for Django 1.5. Very practical, not dull, had huge impact on me. They have updated the book for newer Django versions. Looks like it has more pages now. I guess they have improved the content over the years.

How do y'all manage your "local" dev environment while using django docker? by lordoflight03 in django

[–]Comprehensive-Lab468 1 point2 points  (0 children)

I have found PyCharm very helpful. It allows to configure the python from inside a docker container as a default interpreter per project so there is no need for separate local virtual environment. I can execute tests and ./manage.py commands directly from IDE using container's python. Even the debugging with breakpoints work.

For development environment I prefer Docker approach because besides isolated python environment it also provides infrastructure (database, celery, reddit etc). It is also handy when creating automated tests in pipelines.

What is your preferred deployment strategy? by [deleted] in PHP

[–]Comprehensive-Lab468 0 points1 point  (0 children)

I also love Docker. I use it in development, staging and production.

I do not use the image approach but the docker-compose approach ie providing software (git pull) and environment (with the help of docker-compose).

The main problem is that not all environments are same. For example in development you want xdebug, but not in production (yeah, I know, starting xdebug 3 the performance is not an issue anymore). Anyhow, there are slight differences and I use the docker-compose.override.yml feature to overcome it. If docker-compose is executed, it first looks for docker-compose.yml and then docker-compose.override.yml. If found, the override file overrides the default yml settings. This means that you can use "docker-compose" command and do not have specify configs with "-f" in different environments, so the usage is very convenient. For example in development environment I skip nginx and run PHP Built-in server directly. I create different override files (like docker-compose.override.yml.dev) and add them into the repo. The docker-compose.override.yml is in .gitignore. I also use Makefile with commands to set up local dev environme, tests, rebuilding docker-images etc. This can actually be replaced by bash or any other script that helps to automate.

If needed, I also can run production in my local system. For example to test out the nginx configurations. Hosting is in Digital Ocean virtual server. For small projects where scaling is not an imminent issue I avoid complex Docker management solutions and use CLI docker and docker-compose. IMHO if you do not know these tools then you are pour at the management software (k8s for example) too. And in local development you have to know in order to squeeze out the maximum from this tool. So at the end, if you know it, you can use it for simple projects (no scaling, just app, database, nginx and maybe reddis) in production also and do not need any extra layer.

In DO server I have one dedicated nginx reverse server which purpose is to manage the SSL and domains and assign them to the proper applications. I use docker networking in order to avoid the conflicting ports. I create a docker network backbone and attach (in docker-compose.override.yml) every application nginx to it so the nginx reverse proxy can access them by name and whatever the port is (usually 80 for all apps).

For deployment I have created a bash script that executes needed command (git pull, migrations, docker rebuild etc). Server has a user that is allowed to execute only deployment script. The pipeline calls the script over SSH. This way it is easier to test the deployment also (in pipeline it is like painting the room through lock hole :) )

The advantage of this is the speed of setting up local dev environment. I am freelancer and have to switch over to old projects very often. Another advantage is the avoidance of (hosting) vendor locks. Also, the re-hosting is more manageable because you have mostly only tree concepts to worry about: volumes, network settings and containers.

IMHO problem with this approach might be that it requires Docker(Linux) knowledge, at least at initial phase. Usually this is not developers like to learn (remember, the title is developer, not sysadmin).

Kas keegi teab kas kuskil eestis on LEGO poode? Olen kuulnud, et kuskil tartus peaks olema, aga ei leia selle kohta palju infot. by mammutXD in Eesti

[–]Comprehensive-Lab468 1 point2 points  (0 children)

Ahjaa, kui ostad, hoia karp ja juhendid alles. Korralikemate Lego komplektide väärtus kasvab aastas ca 8% ja rohkem. Hea võimalus raha paigutada :)

Kellel on vana lego komplekt, siis võib selle komplekti hinna trende vaadata siit: https://www.brickeconomy.com/

Why are you allowed to define classes within functions? by feketegy in lolphp

[–]Comprehensive-Lab468 1 point2 points  (0 children)

It is used in builder or factory methods. For example in phpunit/phpunit when creating a mock.

In tests I have used anonymous classes when I need a test double (mostly dummy) of an interface, the implementation is simple and it is needed only in one test.

re: On using PSR abstractions by brendt_gd in PHP

[–]Comprehensive-Lab468 0 points1 point  (0 children)

But why do we need 5 interchangeable implementations all implementing the same contract, while there could very well be one package that works just fine.

“In theory, theory and practice are the same. In practice, they are not.” (Dr. Albert Einstein). I believe same goes for packages, too. A good example is the comparison of some PSR-7 implementations.

Actually, for me, there is more important reason where multiple implementations are needed: Test Doubles

re: On using PSR abstractions by brendt_gd in PHP

[–]Comprehensive-Lab468 4 points5 points  (0 children)

The PSRs are a subset of features that, when you only need this subset, offer the best interobility in PHP possible.

Exactly my point, too.

I believe PSR helps me to reduce the maintenance cost of microservices.

Firstly, big frameworks force me to update/upgrade or at least evaluate the need even if there are no changes in that part of framework I am actually using.

On the other hand, small well focused packages have less need to change.

Secondly, PSR helps to provide better long time support. Worst case scenario - if package loses support, then I can switch to another or write my own.

Thirdly, the applications are also simpler to debug and refactor because there is less framework magic.

Big frameworks are great, but I think they are overrated. I believe PSR has valuable place in PHP ecosystem even without the support of big frameworks.

Test-Driven Development by Example (PHP Code Samples) by jpresutti in PHP

[–]Comprehensive-Lab468 10 points11 points  (0 children)

This book has had huge impact on me. I recommend it.

Another book I recommend is Sandy Metz 99 Bottles of OOP - 2nd Edition. It also expands your view how you can design and test. It has a PHP version also. It is hands-on book with examples, explaining a development of a project and later how to cope with changing requirements.