PHP

Support group for those afflicted with PHP. Don't ask to ask, ...
May 6, 2020 01:29
Thanks for the compiler link!
May 6, 2020 01:28
So this code is buggy but whoever wrote it was lucky enough that the default behaviour randomly works, I guess. Unless this is some kind of trick, but i doubt it
May 6, 2020 01:28
I just checked, it produces a warning but it does use the actual field value for the test variable
May 6, 2020 01:27
@PeeHaa Ah right, I forgot these are a thing.
May 6, 2020 01:14
$jsonArray = json_decode($values[‘jsonString’],1);
$someField = $jsonArray[‘someField’];
$test = $someField[‘randomString’];

Does anyone have any idea what the result of the test variable here is? I see this code and it makes no sense to me, cant test it with a compiler rn. someField in the JSON String is just a single value field, so the notion of accessing the someField-Variable with another string makes no sense to me, there should be a single value inside the someField variable.
Feb 7, 2019 13:41
@PeeHaa Yeah no, thats just wrong.
Feb 7, 2019 13:41
@PeeHaa "It's marketing" is just a really stupid way of arguing against a point. That way you can discard anything that was every written. The argument is valid, be it for marketing purposes or not. It has logical weight to it that you have to argue against.
Feb 7, 2019 13:40
@PeeHaa I had one major project done in GWT, which is up and running well. The biggest hurdle was SEO, which was accomplished by similar things as you linked earlier. A phantomjs rendering views for the search bot in the backend.
Feb 7, 2019 13:39
"It's marketing" is literally the worst excuse ever. There are a hundreds of books that have no interest in shilling single page and that are written by smart people that are in the industry since decades.
Feb 7, 2019 13:37
@bwoebi While that might be true, it has little to do with that the concept theoretically offers
Feb 7, 2019 13:37
Yes, a growing amount of work, in my example = more clients
Feb 7, 2019 13:36
@PeeHaa "Scalability is the capability of a system, network, or process to handle a growing amount of work, or its potential to be enlarged to accommodate that growth." Using your clients resources (the browser) vs not using it at all is better Scalability , period. This isnt exactly a new statement, you can find this in 1000 literature books about single page vs multi
Feb 7, 2019 13:35
@PeeHaa ????
Feb 7, 2019 13:33
@PeeHaa It matters for very specific customer groups, yes. However, acting like this use case just doesnt exist doesnt help negating my pojnt that it "can have real advantages"
Feb 7, 2019 13:33
@PeeHaa By delegating rendering and business logic work to the client you obviously scale a lot better the more clients you have than if everything was handled by your servers backend.
Feb 7, 2019 13:32
@PeeHaa Scale ability, reduced network traffic which can be a real issue for certain customer types (farmes in many parts of the world for example) etc
Feb 7, 2019 13:31
@PeeHaa Debatable. Single Page Applications / RICH client, however you want to call them have some real advantages
Feb 7, 2019 13:29
And for that it typically uses headless browsers
Feb 7, 2019 13:29
@Danack search engines dont like single page applications, so there is this solution where your backend renders pseudo pages just for the search engine
Feb 7, 2019 13:28
@Danack Oh yeah, thats a usual thing for single page application tho, not specific to java
Feb 7, 2019 13:20
That sounds ... really weird :P
Feb 7, 2019 13:15
I said a user is requesting a certain view (actually he is requesting a URL that is bound to some view), the view is rendered server-side and then delivered as HTML. Where did I go wrong?
Feb 7, 2019 13:15
I am not?
Feb 7, 2019 13:14
I'm looking at a project and it somehow has kind of created a second "backend" lol. Is uses javascript in the frontend, namely socket.io and then a node.js server in the "Backend" and the view then communicates with that node.js server via javascript. Pretty confusing, I doubt node.js can do much that PHP in the backend couldnt do
Feb 7, 2019 13:07
So the views are also entirely rendered server-side (unless you use java script) and then delivered as html to the client?
Feb 7, 2019 13:04
Im struggeling a little to understand this: Does PHP also offer a clear distinction between the frontend and backend layer? So when I connect to some urls and post some data around in a controller, that would be something that a client requesting a view that uses this controller would not be able to see, right? As it happens on the webserver, before the user is served it's HTML as result?
Feb 6, 2019 15:55
@Danack Lmao, is the framework actually that bad? :D Sadly I have no choice, project is already existing and built on laravel
Feb 6, 2019 15:49
So if I see shit like this: Schema::defaultStringLength(191), then I check the Schema-class, I can see it doesnt actually provide any method called defaultStringLength. And that is where Laravel magic somehow still resolves it at run time or what? But the IDE obviously doesnt know that?
Feb 6, 2019 15:46
So whatever ... code/classes are downloaded by the composer dependency for the laravel framework doesn't actually end up having the methods/classes you can actually use?
Feb 6, 2019 15:43
What is going on with code completion / suggesstions in php IDE's and Laravel? Why does it need tools like github.com/barryvdh/laravel-ide-helper to work?? I dont understand
Feb 6, 2019 14:11
@Danack So on your host it is in like a usual /work or whatever directory and inside your docker container its mounted into the webservers root?
Feb 6, 2019 14:04
Docker for Windows is still not native, is it?
Feb 6, 2019 14:03
So you docker your laravel projects? Your put your source code inside of a container as well?
Feb 6, 2019 13:59
So do you PHP guys usually set up your local projects under the local webservers root or wut?
Feb 6, 2019 13:51
@Danack Aight! I found a video that goes over the setup, seems like it will cover it. I'm used to things like Spring Boot in the Java world to bring their own embedded application servers so that you usually do not set up anything locally, I thought I read about Laravel doing the same, so i got confused
Feb 6, 2019 13:35
When working with Laravel, do I still need to install a webserver locally? This is really confusing, im trying to setup an existing php (laravel) project locally (windows)
Jan 26, 2019 14:04
@Danack I see, interesting to know! I'm not deep into the whole thing at all so I likely won't understand what you mean specifically, tho. I'm just looking into this fun project that I might get into on the side, but seeing that I have 0 PHP-experience and am mainly a Java-Developer I'm currently just looking at the project to see if I can get myself into it or not. And yeah, it uses Laravel
Jan 26, 2019 13:38
@Danack Pretty interesting, haha. Is that a common way it's looked at or a rather specific opinion? Like for Java, I would say the Spring-Framework and it's modules generally have a really good reputation, but I'm sure if I looked around I would find people having legit concerns and reasons not to use them. Is it that type of situation?
Jan 26, 2019 13:28
@Danack What exactly do you mean by that? You mean the framework kind of leads you to using bad practices? Can you give me an example?
Jan 26, 2019 13:19
It's a neat and fairly effective, good idea, I have to admit.
Jan 26, 2019 13:17
@Danack
I see, surely can happen if the whole thing is set up not keeping that in mind, yeah.
If I understand correctly, the composer uses this .lock file to keep that from happening? And I guess if at some point you want newer versions, some person will test the newer versions and then generate an updated .lock file for everyone else (checked in)
Jan 26, 2019 13:03
Lmao :D What do you dislike about maven that "composer" does better? And is it specifically just maven you dislike or also gradle?
Jan 26, 2019 12:58
@Danack Thanks a lot, thats exactly what I was looking for :D
Jan 26, 2019 12:55
Total PHP-noob here: I'm looking at a Laravel-Project (got it in my IDE), lot's of dependencies missing / unknown classes.
I suppose that PHP projects also use some build tool but i don't know what to look for. In a Java project I would look for a .pom file or .gradle file. What's standard/common in PHP?
Jan 22, 2019 17:01
Right, I think it is that way - if you are given an adress with /22 prefix you actually own 2^10 adresses, because there are 10 bits left that you can play with.
God this topic is so confused lol
Jan 22, 2019 16:52
Random Question about IP/Subnetting, incase someone happens to be around that understands it by chance: If i have been assigned the IP-Adress xxx.xxx.128.0 / 22, do I then also own the IP-Adresses xxx.xxx.129-131.0 /22? Because these have the same netID, right? I dont get this lol, it makes no sense
 

Java

Dedicated to the discussion of the Java programming language a...
Jan 26, 2019 14:55
In Java EE; how do you manage sessions? For example, when you have a @SessionScoped annotated bean, who or where is this bean actually attached to a session? And who or what keeps track of who (what request/session) it belongs to? Is there any automation going on, for example when you use the sessions-scoped bean in a JSF?
Jan 14, 2019 12:38
All good, the article is actually really valuable for debugging JSF. Definitely "under the hood"
Jan 14, 2019 12:22
@dbl Seems like worth a read, especially because I don't know how to debuf JSF. So even if it doesnt answer the question in particular, it helps. Thanks :p
Jan 14, 2019 12:05
Question here: I'm a little confused about how you design your managed beans for JSF-pages. I am very muched used to the MVC-pattern where you have have 1 controller/servlet per page that fills the view with all the needed data.
Does one usually use the same pattern with JSF? So do you usually also design your managed beans per JSF-page? It feels akward because, as far as I can tell, managed beans for JSF-pages usually have state dependent variables, very much unlike servlets that are basically stateless.