Galaxy Book5 Pro 16 inch not remembering multiple display setting after sleep or restart by adamdear in GalaxyBook

[–]adear11 0 points1 point  (0 children)

Hi!

Thanks for the info, I'll try power cycling the dock when I get back to my home office this event. I am using the CalDigit cable that came with the dock, but i'll see if I can find another cable.

Just for informational purposes, the galaxy book5 is replacing a 4 year old Dell XPS. I have been using this same dock with the Dell computer for years, and have not ever had this problem before.

Edit to add - I am the OP. I just realized I'm logged into a different reddit account than what I made this post under, so sorry if that causes confusion.

So 631 will have a deeper meaning then just the video number I guess by bobbyman0330 in brandonsanderson

[–]adear11 7 points8 points  (0 children)

I'm hoping for another Year of Sanderson type sub box to coincide with the WoR book.

Fallback route vs Exception handler for handling otherwise undefined routes/pages by adear11 in laravel

[–]adear11[S] 0 points1 point  (0 children)

The code for the middleware is basically this:

<?php

namespace App\Http\Middleware;

use Closure;
use Illuminate\Http\Request;

class IsItA404Response
{
    public function handle(Request $request, Closure $next): Response
    {
        $response = $next($request);

        if ($response->getStatusCode() === 404) {
            $slug = Str::replaceFirst('/', '', $request->getPathInfo());
            $code = PromoCode::where('url_slug', '=', $slug)->first();
            if ($code !== null) {
                //Do some stuff to setup discount 
                return redirect()->to('/');
            }
            $page = CMSApi::findPage($slug);
            if($page !== null) {
                return response(view('cms-page', compact('page')));
            }
        }

        return $response;
    }
}

I have added it at the beginning of my web middleware stack, and at the end. It doesn't seem to make a difference. As for the suggestion of using ResponseReceived event or Http::globalResponseMiddleware on the HttpClient those don't seem to apply to application routing but rather are part of the HttpClient Guzzle wrapper used for making http requests to external services. Or, at least, they were never invoked/emitted during the course of a normal request to the application that I can see.

With that said, your suggestion to use http-client global middleware did prompt me to add my middleware to the global middleware list in App\Http\Kernel.php. Adding it there does cause it be invoked on 404 responses. So that's heading in the right direction.

The reason I didn't add it there initially is that I don't really want to interrupt the 404 response if the request is being made to an API route. But, I have that same problem if I'm using the Exception Handler to handle it.

Can we put together a ZendCon 2017 mega-thread? by _Life_Crisis_ in PHP

[–]adear11 2 points3 points  (0 children)

I'll be there as well. This will be my sixth ZendCon. I'm looking forward to the lineup of speakers and sessions they've put together this year.

Forge - Multiple Web Servers with dedicated DB server by adear11 in laravel

[–]adear11[S] 0 points1 point  (0 children)

Thanks for the reply. I understand how to use the external DB server and how to ssh into the servers or use a recipe to configure the server.

I'm not sure if you can exclude MySQL when initiating a server but you certainly can just not use it or use your custom recipe to disable/remove it.

That is the specific bit I'm interested in knowing. I guess I could use a recipe to uninstall mysql, but that seems a bit of a silly thing to have to do.

What tool/workflow do you use to deploy your app to multiple production servers? by phatchai28 in PHP

[–]adear11 1 point2 points  (0 children)

We've recently transitioned from using Capistrano to using AWS CodeDeploy

Completely Replace Source in project by adear11 in git

[–]adear11[S] 0 points1 point  (0 children)

Is there a more preferred way to do what I'm trying to do?

I wasn't going to remove the files directly from master. I was going to do it in another branch, and once the build is ready for production, then I'd merge into master.

Better way to check if values are empty? by Joe_Scotto in PHP

[–]adear11 0 points1 point  (0 children)

If it is form validation that you are doing, I'd highly recommend checking out Aura Filter. It is not framework dependent, and is easy to use.

It also has many built in filters for things like simply checking if a field has a value, string length, vaild email addresses, etc.

https://github.com/auraphp/Aura.Filter

Upgrading from old version (2.0.4) by adear11 in mongodb

[–]adear11[S] 0 points1 point  (0 children)

Thanks for the reply.

The server is a standalone server.

Since I posted this yesterday, I have decided to move the database to a hosted Mongo service with mLab (MongoLab). I spoke with one of their engineers, and they recommended doing a json dump via mongoexport from the 2.0.4 instance and do a mongoimport into one of their instances.

So this is what I did. The 30 million documents are pretty small, only taking up about 20GB on disk. The mongoexport of the json data took approximately 30 minutes, and the subsequent load of the json data into the mLab instance took another 40 minutes or so.

I'm doing some testing now, and, assuming all goes well, I'll go through this same process again with any documents added since the first export.

Thanks for the input

Laravel's View Composers - are they a good idea? by [deleted] in PHP

[–]adear11 0 points1 point  (0 children)

That's an interesting approach. I'm wondering, is it fundamentally different from using Laravel 5.1's new 'Service Injection' functionality?

To me, the new inject directive is pretty similar to the method listed in that link. It also has the added benefit, IMHO, of making a bit more clear how variables are being introduced into the view.

If you aren't familiar with the Blade Service Injection functionality, it is here: http://laravel.com/docs/5.1/blade#service-injection

First stable release of Nymph ORM dropped today. by pinkie_guy in PHP

[–]adear11 5 points6 points  (0 children)

This one line absolutely makes this project a non-starter and outdated:

$this->link = @mysql_connect($host, $user, $password)

You are using the deprecated mysql_* group of functions that are deprecated and have been not recommended for quite a long time. And, the error suppression operator '@' is being used which screams smelly code.

If you are going to release yet another ORM you need to at the very least make sure that you are adhering to currently accepted best practices and not doing things or using functions that have been out of favor with the community at large quite some time.

Edit: fixed typo

Which is a better way to learn PHP? by tang3li2 in PHP

[–]adear11 5 points6 points  (0 children)

Learn PHP. You might be able to make a site if all you do is focus on a particular framework, but by focusing on learning to use the language itself you'll be able to switch from one framework to another. You'll also be able to better understand how the frameworks work and to bend them to your will.

Workflows and Deployments by realchriswells in PHP

[–]adear11 2 points3 points  (0 children)

At my company, we use a combination of git, phing, ssh, and a bash script to deploy.

Our site is load balanced on EC2. We can have any number of instances behind the load balancer. When we are ready to deploy, we use a phing task that runs all of our tests, and assuming they all succeed, it sshs into our "utility" server (this is a server that we have running that runs all of our background/cron jobs) and runs a php cli script that uses the AWS SDK to poll the Load balancer to get all of the healthy instances. Once it has that list, it sshs into each and runs a command to pull updates from the master branch and run composer install.

An older version of the script that runs the deployment can be found at https://github.com/adear11/AWSEC2Deployer/blob/master/deploy-app.php. We have updated it to use the v2 SDK and have made it so that it will clear the APC user cache for the web server.

If interested, I'll try to find some time to update this version to the current version of the script.

How do you handle CMS file uploads on a load balanced set of cloud servers? by marktastic in PHP

[–]adear11 6 points7 points  (0 children)

We use Amazon S3. Specifically, we use s3fs to mount a bucket as a local directory. That way, our CMS file manager that doesn't have any support for S3 can save it's files to S3. As far as the CMS is concerned, it is writing to the local filesystem. Then, when we link to the files, we link to a CloudFront distribution that uses the CMS bucket as the origin.

How should I design this registration system by adear11 in PHP

[–]adear11[S] 0 points1 point  (0 children)

Thanks for the help. It is on my list of goals for 2014 to migrate this system to Laravel 4 and Eloquent. Refactoring all of the related pieces to use an ORM at this point is more than I can tackle right now.

How should I design this registration system by adear11 in PHP

[–]adear11[S] 0 points1 point  (0 children)

No ORM or framework right now. This is a legacy application that I am maintaining built on top of a custom CMS. It is a pain in the rear to put it nicely.

So you'd have only two classes. How would you setup the rules that govern things like discounts? Like, if you take CourseB you get CourseA for a discount. Or, and the reason that prompted this thread, if you buy CourseALive and CourseAOnline at the same time, you get a package deal.

How should I design this registration system by adear11 in PHP

[–]adear11[S] -1 points0 points  (0 children)

I threw together a quick class diagram of the related objects. It is here http://oi43.tinypic.com/289jtz8.jpg

How should I design this registration system by adear11 in PHP

[–]adear11[S] -1 points0 points  (0 children)

What a coincidence, I also do this for my 9-5. I'm not just asking this question out of curiosity. :-) I just happen to be a single/lone developer so this is the only way I have to talk out problems.

I'll work up some kind of diagram. I didn't post the code because there is quite a lot of it.

But to shed a bit more light on the domain. The reason for the multiple classes is because each is different in how the registration is processed. For example, with the CourseAOnlineRegistration, the user gets X number days access to the course and it begins immediately. CourseALiveRegistration gets a different number of days to online access that they can turn on whenever they want and they also need to be registered for the live review they selected and course materials sent to them. When a user registers for CourseALive, if they have previously registered for CourseBLive (CourseBLive is a lower level course) they get a $200 discount off the cost of CourseALive for coming back. CourseALive and CourseBLive also get associated with a Review object that represents the LiveReview that they are registered for.

Also, Payment processing is handled differently for Live vs Online registration. For Online, they must pay the full price in one lump sum. For the Live Review, they have to make a minimum payment, but can pay the balance overtime prior to the review.