• Content Count

  • Joined

  • Last visited

  • Days Won


SamC last won the day on July 21

SamC had the most liked content!

Community Reputation

627 Excellent


About SamC

  • Rank
    Hero Member

Profile Information

  • Location
    Surrey, UK

Recent Profile Visitors

1,811 profile views
  1. SamC

    6 months later on my journey and I completely agree with this. Had to modify some jQuery the other day and it was super easy with a relatively decent background in plain JS now.
  2. SamC

    After a bit of research, I think this is one rabbit hole I'm not prepared to go down right now. Sticking to laragon on windows and mamp on osx. I'll go back over these suggestions when my current setup doesn't work for me anymore! But for now, my time is better spent carrying on with my programming. I like the look of this ^^ though. Thanks everyone
  3. SamC

    Thanks for the suggestions, I'll look into these this coming week Me reading that:
  4. I use MAMP on OSX and Laragon on Windows but I've recently been looking at Vagrant and Docker because my life isn't complicated enough and I need more confusion and frustration. Seriously though, what do people here use? Do you have any recommendations and reasons why it would be worth switching from a more 'fixed' environment. I've read docker might be less resource hungry but is trickier to get set up but I don't know the truth in this. Bearing in mind this is just localhost stuff for now but in the future, I am more likely to be involved in a team. Well, it's not all localhost, I have two live sites that I need to work on locally. I'm comfortable enough in XAMPP, MAMP, WAMP, Laragon etc. but Vargrant/Docker looks like a conceptual switch. I do however like the idea of being able to mimic a production environment. I'm also realistic, being 4 months into my JS/PHP learning, is this something that I need right now? Would it be more recommended to stick to the tools I know i.e. just ditch MAMP and try AMPPS. Right now, I'm in a situation where I have nothing on OSX (other than "php -S localhost:8000"). I wanted to install PW and try a few things out which lead me to looking at alternatives. Thanks for any advice
  5. SamC

    Yeah, and you can ignore things like "1 star of 5: didn't teach me how to make an facebook clone" in the comments for a 'Learn basic PHP' course. ^ this. I have anxiety which gets much worse without clear direction or when burning out spending hours upon hours on problems without breaks. This course has helped me massively to break up my learning and provided different techniques to use which has made programming fun again and much less stressful for me which is awesome. So glad @FrancisChung recommended this one.
  6. SamC

    I always do this: What grinds my gears is when hamburger menus are the only option on desktop sites (just for the sake of looking fancy), so I gotta click on it just to show the available options before I can choose something.
  7. SamC

    Don't you need to loop that page reference field (from your original example) if it's a list of tool pages? i.e. $lendoutpages = $pages->find("template=lendout, student_name=$page->id, sort=-lendout_time"); foreach($lendoutpages as $lendoutpage) { echo "<li><a href='{$lendoutpage->url}'>{$lendoutpage->lendout_time}:</a>"; foreach ($lendoutpage->tool as $single_tool_page) { echo "<b>{$single_tool_page->title}</b>"; } echo "</li>"; }; I'm not sure you need to use page->find() twice (as in your reworked example). Something like the above. This post may be useful:
  8. SamC

    Only just seen this, looks amazing!
  9. SamC

    OMG @diogo wow!
  10. SamC

    Very pleasing to the eye nice work!
  11. I know this doesn't solve the issue but I gave up on XAMPP (on windows), was too much hassle in the end, upgrading PHP versions etc... @bernhard pointed me in the direction of Laragon and I've never looked back since, it's a great solution and super easy to upgrade and set up your virtualhosts. I would really suggest giving it a try (maybe not now though as the site seems to be having problems).
  12. SamC

    @mattcohen I'd be interested to look at this site once you're done, always looking to try out new vape gear!
  13. Only just noticed the release_date key is either not there at all, or present, but empty for some movies e.g.: [97] => Array ( [character] => Fred Rogers [credit_id] => 5a709346c3a36847e4012aaa [poster_path] => [id] => 501907 [video] => [vote_count] => 0 [adult] => [backdrop_path] => [genre_ids] => Array ( [0] => 18 ) [original_language] => en [original_title] => You Are My Friend [popularity] => 1 [title] => You Are My Friend [vote_average] => 0 [overview] => The story of Fred Rogers, the honored host and creator of the popular children's television program, Mister Rogers' Neighborhood (1968). [release_date] => ) Had to modify the functions as checking for key existence was not enough: // Movies with release date function hasReleaseDate($movie) { // Has key with value if (array_key_exists('release_date', $movie) && !empty($movie['release_date'])) { return true; } return false; } // Movies without release date function noReleaseDate($movie) { // No key if (!array_key_exists('release_date', $movie)) { return true; } // Has key but no value if (array_key_exists('release_date', $movie) && empty($movie['release_date'])) { return true; } return false; } Seems to work now.
  14. Did this now, code could most likely be improved, but it works: if ($movies) { // Movies with release date function hasReleaseDate($movies) { return (array_key_exists('release_date', $movies)) ? true : false; } // Movies without release date function noReleaseDate($movies) { return (!array_key_exists('release_date', $movies)) ? true : false; } // Generate arrays of movies with/without release date $movies_with_release_date = array_filter($movies, 'App\Controllers\hasReleaseDate'); $movies_without_release_date = array_filter($movies, 'App\Controllers\noReleaseDate'); // Sort by date - newest first function sortNewestFirst( $a, $b ) { return strtotime($b["release_date"]) - strtotime($a["release_date"]); } usort($movies_with_release_date, "App\Controllers\sortNewestFirst"); // Append movies without release date $movies = array_merge($movies_with_release_date, $movies_without_release_date); View::renderTemplate('Actor/list-all.html', [ 'name' => $this->getFormattedName($name), 'movies' => $movies ] ); } else { View::renderTemplate('Actor/no-results.html'); } The more I move on with this, the more I see the importance of finding some kind of structure. It's starting to confuse myself with where to put code, whether it goes in a model, a controller etc. Def need to work on this. However, all good for now thanks @arjen
  15. I'll give this a try, thanks. Thanks, had a problem submitting, 2mins+ with nothing haopening so I refreshed, waited, waited, redreshed, tried again. Third time submitted normally i.e. took seconds. Not sure what went wrong, maybe dodgy internet.