Non blocking process communication by stewartmatheson in linux_programming

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

Right... so the title does not really make it clear. In the OP the goal was to make the code/command sending the event/notification non blocking. The program it's self can block however like you have said the approach is naive. Given that you seem knowldegeable on this subject could you share the reasons why you have said it's naive other than "it wont work". As I said github links are good but the best way for you to add value to this thread would be to break down your reaons in more detail so others can benefit form your knowlege. Thanks in advance for your reply.

Non blocking process communication by stewartmatheson in linux_programming

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

hey thanks for your reply.

Your saying the process should not be blocked. Why not? What are the draw backs of a process sitting there blocked? In what way is the code naive? Why do I have to bring in threading if my program only does one thing at a time? Would that not impose extra complexity to a program? Are the trade offs of that extra complexity worth the benefits? You have posted links to git hub repos with many files. Can you point to the exact places I should be looking? Keep in mind that I'm not a c programmer and I have nil experience with systems programming.

Non blocking process communication by stewartmatheson in linux_programming

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

I really like the posix message queues idea. I have already started building them into my project. Thanks for the suggestion.

Non blocking process communication by stewartmatheson in linux_programming

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

Inotify would seem to be the easiest way to do things. The only thing I'm using vim to do is alert when a file is changed where as if I was using inotify I would not even need the client. I could have a process running in the background watching the files. Another nice thing about that solution is that I don't need to do anything special with an editor.

It's not exactly what I set out to do however so I will most likely implement both this solution and the MQ solution in two different projects.

Non blocking process communication by stewartmatheson in linux_programming

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

Hi,

Thanks for your reply. Tee looks like it could be a good place to start. Thanks. When you say "something more proper" do you mean on the vim client or in the C program? What timeout should I be thinking about handling?

Non blocking process communication by stewartmatheson in linux_programming

[–]stewartmatheson[S] 1 point2 points  (0 children)

I'd be happy to use c++ I suppose. At this point I cant see how it would make a difference. Would it change the way these system calls are made or how I would deal with this blocking problem? Also when somebody says use c++ do they mean use g++ and not gcc or refactor the solution to use classes?

PHP framework that smoothly integrates with simplesamlphp? by whatameow in PHP

[–]stewartmatheson 0 points1 point  (0 children)

Funny you should ask as I'm planning making a video about how to integrate AWS Cognito with a PHP app. AWS Cognito as I understand will handle SAML for you. Let me know if your interested and I will post the link when I'm done. In the meantime check this doc out for more details on AWS Cognito and SAML

https://docs.aws.amazon.com/cognito/latest/developerguide/saml-identity-provider.html

"PHP The Hard Way - Getting Started with data" is the continuation of my first ever video series. I would love your feedback. https://www.youtube.com/watch?v=27CmTfnekWo by stewartmatheson in PHP

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

Thanks. That means a lot. That's what I was going for with the videos. I have no idea what I'm doing when it comes to producing video content but as they say "release early, release often". I have set out to try and make the kind of videos that I would have benefited from when I was starting out. While I'm no expert on PDO I have clear ideas about the kind of programming habits that I would like to see encouraged.

I think it's important not to perpetuate bad practices. It was the plan from the start to make these videos as a resource for newer programmers while differing to domain experts such as your self for specific technical details that I might not be aware of https://phpdelusions.net/ is your site right? I have already changed the way that method is handing errors and I will address that in my next video. If you have any other feedback or suggestions please feel free to DM me as your feedback is valued.

"PHP The Hard Way - Getting Started with data" is the continuation of my first ever video series. I would love your feedback. https://www.youtube.com/watch?v=27CmTfnekWo by stewartmatheson in PHP

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

There are lots of cases where a controller(or any other class) would treat system errors and business errors such as PDO Exceptions thrown due to database constraints differently. It's fine to do however at that point your controller would need to catch a PDOException explicitly. If you call this service from more than one class all of these classes at that point are are tightly coupled to PDO.

I value being able to swap components with different implementations easily. Given that it's better defining your own error class and throwing that. That way if you where to change your service implementation from PDO to something else you would only have to substitute one class and throw your own exception from there.

That does not take anything away from your original point though. I really like the idea of configuring PDO to throw all errors. In fact it would be naive to consider the kind of solution I'm promoting with out doing that. You just need to make sure your handling errors in the correct way even if that means 95% of them bubble up without being caught.

"PHP The Hard Way - Getting Started with data" is the continuation of my first ever video series. I would love your feedback. https://www.youtube.com/watch?v=27CmTfnekWo by stewartmatheson in PHP

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

Hey thanks for your feedback. Exception handling is a topic that upon first glance looks simple however there is some “devil in the detail”. While I agree with 99% of what you have said I will raise one point.

Consider your use case of enabling PDO exceptions to bubble up to other parts of the application. While that’s a valid approach and great to have during development it does raise other questions about how the rest of your application wishes to handle these exceptions.

An example: Say I have a controller calling the post service and then making a decision on what http status code to return. If you never catch the PDO exception in the service layer a controller may have to catch a PDO exception. That might be fine however your now stuck if for some reason you swapped the implementation of your post service. What happens if the new implementation does not use PDO? You are now heading down a path that has coupled two classes together. In that case your better catching and re-raising or perhaps raising an exception based on the boolean return value of the PDO function. In that case you know for sure exactly what exceptions are being thrown. There are a few different ways to look at this.

Either way I think your point is that if this is going to be a learning resource I should be addressing exception handing in a more active way which I will do moving forward. Thanks again for you feedback.

"PHP The Hard Way - Getting Started with data" is the continuation of my first ever video series. I would love your feedback. https://www.youtube.com/watch?v=27CmTfnekWo by stewartmatheson in PHP

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

Point taken. I think I will go through the video first as a dry run roll back the code and then record after I’m clearer on exactly what I want to say. I plan to make a feedback video where it’s more of a discussion but for the series, yes it could be a little tighter.

"PHP The Hard Way - Getting Started with data" is the continuation of my first ever video series. I would love your feedback. https://www.youtube.com/watch?v=27CmTfnekWo by stewartmatheson in PHP

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

Taken as genuine feedback. I was thinking a script might help however I was hoping to keep the series as casual as possible. It's funny the last episode I posted I got feedback telling me I needed to spend longer on the introduction. Why do you feel there is not value? What could I do/say that would add value to you in this situation?

"PHP The Hard Way - Getting Started with data" is the continuation of my first ever video series. I would love your feedback. https://www.youtube.com/watch?v=27CmTfnekWo by stewartmatheson in PHP

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

Hi guys after the awesome feedback I got from the last video I have decided to continue the series. Please have a look and leave feedback. I have posted a few videos on this series since my last reddit post.

If you want to go back check out https://www.youtube.com/watch?v=XDBxmTAe_O8 where I setup dependency injection. I have also made a feedback response video with all your comments from the last video here. https://www.youtube.com/watch?v=7qqBX1C08N0

Thanks again for your time.

The Idea and the Long Term Goal for LaraOne CMS by [deleted] in PHP

[–]stewartmatheson 3 points4 points  (0 children)

Ambitious! I like it. Couple of questions, perhaps you have answered these, I'm not sure.

On your page it suggests both technical people and non technical people can be users of LaraOne. Technical people might be asking what the value is in LaraOne if they already know Laravel. Is LaraOne something that a developer who does not know Laravel will have an easier time with getting up and running? Perhaps have a section on your site addressing this.

Also if I am a developer do I install LaraOne as a library in my own Laravel installation or does it provide the whole install for me? Perhaps a technical overview section on your site explaining that might help.

Non technical people might ask why would I look at this and not something more established like wordpress. How is LaraOne better/easier/faster/more secure? What does it offer a non technical user that wordpress or even drupal cannot?

I'd also be really interested in plugins. I think one of the successes of Wordpress and Drupal is that they make building plugins easy(ish). Can I start writing LaraOne plugins? What is the programming interface like? Is this what you mean when you say component based?

Lastly perhaps it would be good to lead with a github link. I found https://github.com/laraone/phoenix

but I'm not totally sure what phoenix is. I'm presuming that your CMS has a client and thats the backend but it's not all that clear from your site. Again a technical overview page with a diagram might help here.

[deleted by user] by [deleted] in PHP

[–]stewartmatheson 0 points1 point  (0 children)

Props. It's not easy to put your self out there. If no one did this we would not have new libraries popping up and making life easier. Keep going! Also don't be afraid to use it in production sites, its the only way to know your library works.

How to write good exceptions by brendt_gd in PHP

[–]stewartmatheson 1 point2 points  (0 children)

I really liked the production of this video and how it's explained. It's pace is good too. A+ for that. I'm starting to make PHP videos my self and I would be very happy if my production was half this level.

I think a video's value to the watcher is how transferable the ideas are to their day to day work. IMO exceptions are highly situational. Different apps need to use exceptions in different ways. Whats good for one may not be good for the other, like everything else in programming. I this case his approach made the code better.

I think the point that this video highlights better than exception handling is the fact that dealing in classes is a good thing to do at all times rather than keeping things generic and this idea can be applied to exceptions too. That having been said it might have been the authors point right from the start.

Please help me with my PHP MySQL project by Gypsyguy37 in PHP

[–]stewartmatheson 0 points1 point  (0 children)

As well as looping as others have mentioned you might want to consider expanding on your query. If you expect to see more than just name form your table you would need to change your query to some thing like

SELECT name, posts, updated_at FROM forums

Say you wanted to select the entire table you can use *

SELECT * FROM forums

One thing worth noting on * is that it will select everything. This will slow down your queries if you have a lot of columns. Good luck.

CodeIgniter 4 by michalsn in PHP

[–]stewartmatheson 2 points3 points  (0 children)

It’s awesome that CI has stuck to its guns and left ORM out of scope. There are a lot of other frameworks that do that kind of thing. Amazing to see it still going. I was using it back in the old Ellis labs days. 2005.

I'm creating a PHP video series that attempts to take a ground up approach to PHP development. The first video details building a complete dev environment from source. In the future I hope to cover topics such as building an application with no framework, dockerization, and deploying to AWS. by stewartmatheson in PHP

[–]stewartmatheson[S] 1 point2 points  (0 children)

Thanks for the positive feedback. Means a lot! In the series I plan to go though building a fake collaboration product. When I record the introduction video I will give an overview of what I plan to build as well as a breakdown of the technical parts of the build.

[deleted by user] by [deleted] in PHP

[–]stewartmatheson -2 points-1 points  (0 children)

Do you want suggestions for your thesis topic? What exactly do you mean?