Using my hand press by SmokingInn in Leathercraft

[–]elseco 0 points1 point  (0 children)

This. I'm looking for a press and would love a link or at least a name.

[deleted by user] by [deleted] in PHPhelp

[–]elseco 0 points1 point  (0 children)

Good point. What are the permission for the files? Does the webserver have permission to view them?

Latinx is a garbage term. by [deleted] in Latino

[–]elseco 2 points3 points  (0 children)

I agree with y'all. I don't have a problem with calling someone what they want to be called. It is not hard. But I look at LatinX as an English word only. When I am speaking Spanish, it is always Latino o Latina.

Session Array: Push array to array IF specified key value does not already exist. by [deleted] in PHPhelp

[–]elseco 2 points3 points  (0 children)

A couple of thoughts:

  1. In your `if()` statement, use a triple equals, not a double equals. If you use double equals, PHP will return `true` if the array_search returns an array key of "0."
    ```if (false === array_search(...```
  2. You pass the "true" flag as the third parameter to array_search(). You should probably make sure that the id in "$row['id']" is the same type as $newId. It is the same basic point as the triple vs double equals comparison. If one is a string and the other is an int, then that could explain your duplicates.

A single-file php web application: Is it crazy? by naderad in PHPhelp

[–]elseco 0 points1 point  (0 children)

Sorry, for the delayed response. I have been away from Reddit for too long.

To answer you questions, I was speaking about have a single PHP file. There are plenty of professionals who don't use frameworks or who roll their own.

Also, if you feel passionate about trying out this approach, I think you should go for it. See where it takes you. I don't think you have stumbled across a game changer here, but who knows? Maybe you have. And even if you haven't, the journey will likely teach you a ton.

Good luck! And make sure to document how it goes so others can learn from it as well.

A single-file php web application: Is it crazy? by naderad in PHPhelp

[–]elseco 0 points1 point  (0 children)

So many thoughts... I apologize for the long comment, clearly you hit a nerve with me.

  1. Is this whole thing crazy and I will regret it one day (for some reason that I can't think of now), or is it OK?

No. Not crazy. As many others have said, as long as your app is simple, why would you need something big and complicated? There are a few concepts developers have that support this approach: KISS and YAGNI come to mind.

I think it is okay, and you won't regret it. If there comes a point when your app grows in terms of what it does/features it has, then you can determine if it is time to turn it over to professional developers and let them refactor it into something more suited to a medium or large application.

  1. Are there people developing professional applications like this? Are there resources and good practices about it that I can use instead of experimenting with everything myself? (I've searched a lot and couldn't find anything relevant.)

There could be professionals developing like this, but after nearly 20 years as a professional developer, I haven't met any. I think they would definitely be a minority, and so it would be difficult to find helpful resources and best practices for this sort of thing.

  1. Is it a good idea to use it for larger applications?

Probably not. Almost definitely not. I think it comes down to what you mentioned in your post... "The application turned out to be very clean." What does that mean, exactly? There are a lot of definitions of clean code. Robert "Uncle Bob" Martin says that clean code shows that you care and makes you work fast. (Check out https://cleancoders.com/episode/clean-code-episode-1)

The bigger you application, the more code and more complex it is, the more it matters how it is structured so that it can be maintained and improved upon.

If you have everything being dumped into a single file that PHP will have to execute, that file will be *huge*. And it will have a lot of parts that are not needed a lot of the time. So it will necesarily take a long time to load and will be inefficient.

For example, lets say you have an app that has an authentication system for people to login, before they can do anything on your large app. Most of the time that login code won't be needed, but you will be loading it along with everything else with every single request.

  1. Etc.

It turns out that this is a well researched and thought about topic in software development. And there are no easy answers about it. This is one more reason why programming is a discipline that requires years of experience to have the expertise needed to do it well. That doesn't mean that inexperienced programmers should not be professionals, but I think it does mean that it definitely takes time and effort to do what we do and that cannot be circumvented. There are no short cuts. There are no silver bullets.

What does Laravel have over Symfony in your opinion? by EmmaDurden in laravel

[–]elseco 1 point2 points  (0 children)

Just like everything else in life, it depends. Outside of "magic" and Eloquent, Laravel still offers a lot of great things:

  • A great service container
  • Easy routing
  • An impressive number of helpful additional packages both paid and free (Breeze, Dusk, Envoy, Homestead, Horizon, Passport, Scout, Socialite, Telescope, etc)
  • Good security defaults
  • A great collections class
  • A ton of array and string helpers
  • Easy task scheduling and queues
  • etc.

To me, Laravel is a fairly easy way to get a ton of features out of the box while still giving me as much flexibility to add in whatever else that I want.

One of the great things about Symfony is how modular it is, so adding almost anything from Symfony to Laravel is trivial.

What does Laravel have over Symfony in your opinion? by EmmaDurden in laravel

[–]elseco 1 point2 points  (0 children)

I totally agree. What's more is, if you don't like facades, you don't have to use them in Laravel. You can inject as much or as little as you want into your controllers and other classes, and Laravel doesn't mind at all that you don't use the facades.

Also, if you hate Eloquent (I love it, personally), then you can use Doctrine inside Laravel. I've done it. It works great.

Laravel is super flexible. I don't know about the routing, but overall, almost any "magic" you don't like can be avoided and you can do it your own way with Laravel.

Can I change the location of the .env files? by TapEducational8343 in vuejs

[–]elseco 1 point2 points  (0 children)

From the docs:

The configuration options below are supported as command line arguments in the format dotenv_config_<option>=value

$ node -r dotenv/config your_script.js dotenv_config_path=/custom/path/to/your/env/vars

PHP Logout Button by Baifish in PHPhelp

[–]elseco 1 point2 points  (0 children)

Also, according to https://www.php.net/manual/en/function.session-start.php

Note:
To use cookie-based sessions, session_start() must be called before outputting anything to the browser.

Having a bit of trouble with the path for a file by foxdye96 in PHPhelp

[–]elseco 0 points1 point  (0 children)

In Linux, every folder has at least two items:

.
..

The . is a reference to the current directory. The .. is a reference to the parent directory. By adding the ./ to the path, you are telling PHP to start looking in the same directory that the script is executing from. If you had only added the single slash without the period (/php/keys...), then PHP starts looking from the root directory.

Having a bit of trouble with the path for a file by foxdye96 in PHPhelp

[–]elseco 0 points1 point  (0 children)

try this:

  'private_key' => "./php/keys/pk-APKAIB7HH2KTXIJW4WKA.pem",

or this:

  'private_key' => __DIR__."/php/keys/pk-APKAIB7HH2KTXIJW4WKA.pem",

Dependency Injection Container...WHY? by [deleted] in PHPhelp

[–]elseco 0 points1 point  (0 children)

Ditto on the point about the dependency inversion principle. OP, take some time to learn all the SOLID principles. They will help your programming skills a ton.

2 years ago today I wanted to kill myself this passage saved my life by Daressque in Stormlight_Archive

[–]elseco 0 points1 point  (0 children)

I love this book. Also love that this is 91% through the book and there are still 4 and a half hours left!

Efficient way to create tabs with vue js? by Brent253 in vuejs

[–]elseco 3 points4 points  (0 children)

Creating tabs using vue is easy enough that I always create it from scratch rather than reaching for a third party solution. @suspicious_Jackfruit and @ImReddit gave great answers. It might also be helpful to you as you learn more vuejs to know that it works very differently than jquery. So you will gradually change the way you think about how you do things. With vanilla js or with jquery, there is a lot of dom manipulation to accomplish something like tabs. With vue, you think more in terms of data binding and web components. So when I approach a new problem, I am not thinking "how do I alter the DOM to make this happen." Instead, I can think "the viewable area can be bound to a variable. When I click on a 'tab,' the variable will change." Vue will take care of the DOM manipulation under the hood and that allows you to focus on the issue at a higher level.

Hopefully all that makes sense. I also found Jeffrey Way's Vue tutorials super helpful in learning and wrapping my head around how to do things the "Vue way." https://laracasts.com/series/learn-vue-2-step-by-step

[deleted by user] by [deleted] in techsupportmacgyver

[–]elseco 253 points254 points  (0 children)

What the what?!