Categories
Web Development

Top 10 reasons why webdesign, web development and programming in general really suck

The longer I program or do anything with webdesign the more I absolutely hate it with a passion. Here is why.

  1. Nothing works
  2. Nothing works
  3. Nothing is documented worth the shit so it takes forever to figure out how the hell the idiot authors system works. Nothing but hours of frustrating trial and error. But their marketing sounds so damn awesome that everyone just has to learn and use it.
  4. Bugs galore and then more bugs. NOTHING WORKS
  5. Nothing works
  6. Browsers really suck at CSS/Javascript each does it’s own thing, how and when it wants. Screw you if you know how it should work the team at browser x has different ideas. NOTHING WORKS
  7. The tools suck and the industry jumps ship to new tools monthly, tools that do the same shit in a different fail ass bug filled way NOTHING WORKS
  8. Too many clueless amateurs pumping out shitty undocumented spaghetti code… NOTHING WORKS!!!
  9. Most tools are dysfunctional chaos at best NOTHING WORKS!!!
  10. You learn the same shit over and over and over every time a new Library or framework comes out or some new Amateur has a great idea that other Amateurs think sounds great.. NOTHING WORKS!
Programming sucks because nothing works

I swear if a mechanic had to deal with the same shit developers deal with then their day would go like this

  1. Get to work 1/3 the tools are broken  and you must order new tools and learn to use them. But these tools even with the same name and function are a new version and work totally different. And you must learn how to use them through trial and error because the docs are totally  off and missing steps.
  2. Some of the tools that worked one way the other day now work totally different today. Got to learn the changes before work begins
  3.  Another 1/3 of all the tools were stolen got to order new tools and well some of those new tools changed so you got to re-learn how to use them. and about 1/3 of the new tools you ordered will be totally fubar broken and never function
  4. You finally got all your tools ordered and relearned now you have enough time to remove 1 bolt
  5. Manufacturer can’t write steps of how to use their product. It requires 10 steps, but lame brain in doc department leaves out 4 so you get 6 steps and are left saying WTF!!!

Next day you start all over again and get bolt 2 off.

Seriously what other industry do you have people just intelligent enough to create things but not intelligent enough to explain how the hell their invention works? NONE NO OTHER DAMN INDUSTRY. There is no other industry full of so much time wasting bullshit and chaos. NONE NOT ONE.

It is like trying to put together furniture where the manufacturer gives you 1 picture of the final product which takes 20 steps to complete and they decide you only need to know 11 of them FFS.

The more people who start web development and programming the worse the industry gets. This shit takes knowledge and organization. At the current rate I predict soon computers won’t even start in 10 years.

Categories
Web Development

How to get the user id in a service in Symfony 5

You might try UserInterface but I know that Security will work. You type hint aka Dependency Inject your service constructor with Security but not just any Security will do there is also one by Sensio labs and another. You want this Security

use Symfony\Component\Security\Core\Security;

Then your id wont show it or will warn something about a polymorphic call blah blah, but apparently there is a getId() method of the user returned from Security and you can get a user id like this.

 $userId = $this->security->getUser()->getId();

That is how you can get the current logged in users user id; My IDE PHPStorm doesn’t even know getId() exists so I had to do some digging.

Categories
Resources Web Development

How does login and authentication work in Symfony 5.*

This is mostly for myself as a reminder, as the info is scattered to hell wont have it, because that is the dysfunctional symfony way.   The most frustrating part of Symfony is Authentication because the information is scattered all over between articles, symfonycasts etc. just all over, like you couldn’t scatter it more all over, all, all over like a unicorn farting out rainbow sprinkles.You won’t find shittier documentation on any subject anywhere on the internet.

There are two versions of authentication an old one and a new one. The old one uses Authentication providers the new one users just Authetincators. No one but the authors of Symfony know WTF the difference is though.

Note : to add confusion Symfony refers to what you usually call Sessions as Tokens FFS.

First off a list of files involved in the login process :

  1. The login form obviously app/templates/security/login.html.twig
  2. A security controller app/src/Controller/SecurityController.php
  3. A user Provider aka the User entity class app/src/Entity/User.php
  4. An Authenticator app/src/Security/LoginFormAuthenticator.php

When a user requests /login Symfony first calls LoginFormAuthenticator.php to check to see if the user is logged in/authenticated so the work is not done in the controller like most other actions. To change, add, remove anything from the authentication process you make changes in the LoginFormAuthenticator.php methods.

There is a new experimental Authentication system it still uses authenticators but a slightly different process.

This authenticator is listed in the app/config/packages/security.yaml file under firewalls:main:guard:athenticators as

- App\Security\LoginFormAuthenticator

symfony firewall authenticator section

Every time a request is made the firewall will use the authenticator listed to try to authenticate the user. If authentication fails Symfony secretly behind the scenes tries other ways to authenticate the user as you can see in the image below.

symfony guards
Secret guards attack

As you can see in the image above Symfony will try your guard you listed in the configuration file, but it also tries it’s own secret list of default authenticators.

For information about the login form see this article in the scatterdocs. A little more info about the login form and process from the Symfony Spaghetti docs.

Categories
Resources Web Development

Symfony Session resources list

Plain session docs – This is the symfony documentation page about Sessions alone. This link shows the basic configuration and use of Sessions in Symfony. This also mentions not starting a session for Anonymous users and has links to other info about sessions.

Configuring Sessions and Save handlers – Symfony documentation link. This covers more about how to configure sessions and their Save Handlers. This is some of the better information about Sessions and how they work in Symfony. It covers the save handlers and more of the configuration information.

Session proxy examples – Symfony Documentation link. This covers how to create your own session handler. It also discusses how to encrypt session data with an example.

Framework configuration – Symfony documentation link. This covers many of the options for the security component of Symfony.

Store sessions in a database – Symfony documentation link that describes how to store session data in a database or Redis.

Session Management – Symfony documentation link. Explains how sessions are managed in symfony. Gives a good overview and important information about how symfony functions. It covers the functions symfony uses to replace PHP session functions and how to use them. This also covers the ways to work with sessions in Symfony. Oddly this covers Flash messages too.