« first day (2416 days earlier)      last day (2526 days later) » 
00:00 - 19:0019:00 - 00:00

12:06 AM
once again phpdbg saves the day (helped me find my off-by-one error in class naming). thank you, @JoeWatkins.
 
I really need to learn using it :(
 
@tereško I literally only use one command: print exec
 
I use a lot of var_dump()as a tool of debugging
basically, I am stuck at "banging two rocks together" in my education, when it comes to code debugging
 
@Andrea or p e in short form
 
@bwoebi neat, thanks!
 
12:16 AM
@Andrea actually, I think p is enough, as exec is the default mode (if I remember correctly)
 
12:29 AM
prompt> p
[Not Executing!]
@bwoebi
 
... I preferred the one box.
 
@Andrea oh, default is current executing op array, right
 
I use var_dump a lot, too and am considering creating a shortcut for it, since I have to type as much as vardu[tab] (i.e. 6 key presses...) in my current Atom setup - I also echo from certain points (i.e. "Hello from test_success"), to see if the code even gets to that point of execution.
Advantage of print over echo is that it doesn't need brackets, but need to be careful because it only takes one argument, right?
 
no, was wrong - echo doesn't require brackets either
 
12:59 AM
documentation incorrect for handler mapping – #74666
 
ahahaha
Fatal error: Class Foo::Apples may not inherit from final class (Foo) in Command line code on line 1
PHP is too clever for me.
I'll have to coerce it to ignore the final check somehow…
 
please don't do that through an rfc ;)
 
well, it won't be a user-accessible ability…
 
1:16 AM
heh. I was mostly joking. I don't recall ever using final class so, that it be really final or not doesn't really bother me :)
 
oh gods PHP has static method inheritance
aaaaaaaaaaaaaaaa
 
what's not to like?
 
@Andrea yeah, and?
 
classes inheriting static members is absurd and also unhelpful
 
@Andrea I'm not sure
 
@Danack no, you've removed a digit too much
 
beat me to it
 
Anonymous
what kind of api is this toptweet.org/user/__obeydensiee
 
a rather... custom one?
 
$ sapi/cli/php -r 'enum Foo {/** */ Apples, Grapes, Parsely} $x = "Foo::Apples"; function f(Foo $f) { var_dump($f); } f(new $x);'
object(Foo::Apples)#1 (0) {
}
ooh I just realised something interesting. hmm…
yep, protected constructors exist and work!
fantastic.
 
1:30 AM
@Andrea I … umm … you should guarantee that there is only ever at most one instance of the same enum value
 
@bwoebi …ah drat, good point
 
Anonymous
@Andrea What exactly are you doing? I see nothing I recognize from PHP in your code and I am curious
 
@samayo adding enums which are like algebraic data types
 
@Andrea (That's another reason why I think object instances aren't the right way to go)
 
@bwoebi you'll definitely think that when you see the code :p
 
1:32 AM
@Andrea are you applying gruesome hacks?
 
@bwoebi not… exactly, except for ignoring the final check in inheritance. But creating classes is messy.
 
Well, I'm intrigued to see, what your final version will be… :-)
 
Anonymous
@Andrea Is there even a solid use-case for enums?
 
@samayo lots
 
Anonymous
I hope it's not like syntactic sugars
 
4:19 AM
It's more than just syntactic sugar. There are a number of enforcements which are possible with first class enums. Unhandled switch case, invalid (but otherwise appropriately base-typed) value as argument, etc...
 
5:00 AM
posted on May 28, 2017

New Cyanide and Happiness Comic

 
5:29 AM
@tereško well if I want to pull the project on the web server (to update the website), I need to init the git on the working directory first. so .git folder will be created there, is that ok? isn't human-readable code in it?
 
 
2 hours later…
7:30 AM
@JoeWatkins I have some free time later today, so I'll begin merging some PRs/dealing with some issues then :)
 
@tpunt thanks :)
 
Is there anyone has a link for a tutorial of php connection with html form on one file
 
@KerrialBeckettNewham you fubared. reinstall.
 
Morning
 
7:49 AM
 
8:03 AM
mornings
@JavaFan Here is an example: stackoverflow.com/a/8227049/367456 - it lacks error handling if the save operation fails
 
@Shafizadeh if you want to use git for updating your production code, you should start by creating a document_root, that is not the same as application root
/my_project  << application_root
    /.git
    /docs
    /src
        /app
        /config
        /public   << this is where document_root should be
    /tests
    /vendor
    composer.json
    composer.lock
so on a webserver the full path to your document root would be something like /var/www/hosts/my_project/src/public
 
Wes
9:05 AM
\o
 
o/
 
\0
 
@tereško emm .. not sure what you mean exactly, but I guess I got a clue. thx :-)
 
@Shafizadeh which part confused you?
 
in which directory should I run this command: $ git pull origin master ?
 
9:15 AM
in the project root
 
@tereško you mean my_project directory?
 
yes, in the example: /var/www/hosts/my_project/
and when your user's visit the page, the http://who.cares/ lands in the /var/www/hosts/my_project/src/public/index.php file
that file then contains only:
 
in this case, all these files should be exist on the repo: composer.lock, composer.json, /vendor, /tests, /src, /docs, /.git`
right ?
 
yes
well .. not /vendor, because that folder should be added in .gitignore
 
@tereško aha
seems correct, because in this case, accessing /.git is impossible through a http request.
 
but making such structure would be hard on local !
 
@Shafizadeh also it is impossible to access your /docs folder (that where usually my default SQL schema ends up being stored)
@Shafizadeh why?
sorry for multiple pings :(
 
@tereško because I think you haven't work with xampp so far ..!
 
well ... it has apache somewhere
and somewhere in the apache folder there will be httpd.conf file (which is where you set this stuff up)
 
yes, but it has a directory named htdocs which is the same as public directory on the real server. So in your case, I have to initialize the git out of htdocs directory I guess, seems weird!
 
9:25 AM
@tereško Closed as too broad
 
but you can change it
8
Q: xampp change document root

Matthew UnderwoodI have eclipse IDE and I have set up a workspace in "C:/users/matt/documents/web/". I set up a project called test in the folder test "C:/users/matt/documents/web/test". I have changed the Document root in the httpd file to "C:/users/matt/documents/web/" and the same for I put "C:/users/matt/do...

@MadaraUchiha I was pointing to the answer, not a question
:P
 
@tereško What's your point?
@Shafizadeh You're serving your source directly?
What do you do for JavaScript bundling/minifying/compiling?
Or is it a go commando jQuery main function kind of project?
 
@MadaraUchiha not sure what are you talking abouve, but yes, sometimes I serve my website on port 8000
 
@Shafizadeh I mean in production.
Are you not minifying your JavaScript/CSS resources?
 
I do, by gulp
 
9:32 AM
So how can you have a .git directory on your server that's inside/outside of the public directory?
Are you building on the production server?
 
currently I don't have .git directory on the server, I minify JavaScript/CSS files in local, and then upload them on the server
actually I haven't even installed git on the server yet
 
Ah, okay, makes sense.
 
@MadaraUchiha please notice that this is PHP room. Why did you start asking him about JS ansd CSS?
 
@tereško Because JS and CSS are better than PHP, duh.
 
@tereško Don't be strict :-)
 
9:36 AM
@tereško Talking about .git directory in relation to the production server made me wonder if he's serving his source files directly.
 
I still havent had my breakfast .. I am in an easily annoy-able state
 
Go eat your breakfast then.
Huh, it just occurred to me why breakfast is called breakfast.
 
@MadaraUchiha you mean like what I was explaining here: chat.stackoverflow.com/transcript/message/37329436#37329436
 
@tereško ok, I will start implementing this. and as my last question: My repository on the bitbucked should look like this structure, right?
bitbucket (I could edit my comment instead, but I didn't, since you hate multiple pinging)
 
9:48 AM
well ... similar
 
ok, got it
thx
 
9:59 AM
@tereško ok one thing, when the user visit mywebsite http://who.cares/, normally it refers to /var/www/hosts/my_project/ and it looks for a index.php file there. if it doesn't find index.php there, it will open that directory and show all existing folders/files, in there
I mean, it won't automatically refer to /var/www/hosts/my_project/src/public/
am I right?
 
yes
and you do that by altering the document root in apache or nginx
 
ahhh .. now it makes sense
thx
 
if it does not find that file, it should show 404 error actually
 
@tereško now I understand why you linked this
 
that index.php file should contains something like:
<?php
require __DIR__ . '/../application/bootstrap.php';
(that's the entire file)
basically, your goal is to have all your logic outside the document root
 
10:04 AM
that's correct
 
that way, when something terrible happens, you will not expose your code
 
yes, it is a good idea
 
morns
 
@tereško now I'm thinking why not all files (controllers and models, except views) be out of the public directory?
in this case everything will be inaccessible (safe)
 
@Shafizadeh well .. in the example I showed you, they would be in the /src/application directory
and, views would be there too
the approach is called "single point of entry"
 
10:09 AM
I see, why didn't you tell me this approach already?
 
user opens the site, it hits the index file, get passed to bootstrap (which is already inaccessible from outside), user's request gets router, based on routing's extracted paraemeters the files are loaded, and user gets returned a rendered result
@Shafizadeh because I assumed you were already using it
I haven't actually looked at that repository of yours for something like 3 months
 
:-)
ok, thanks
@tereško just it would be much more clear for me if you show me the place of bootstrap.php file in your example structure
ok no need, I got it
my confusing was your words, sometimes you've used application and sometimes app :-)
 
yeah, I forgot what I wrote in the example
 
10:39 AM
morning guys and girls
 
11:02 AM
hi
 
cc @tereško :D
 
wat
 
Is there difference between using echo '<html>' and using echo "<html>"
 
time allowed: 2 hours
 
11:07 AM
@JavaFan " allow for interpolation
 
@MadaraUchiha so ... they are teach humans to be "web browsers" "rendering engines"
 
hahahahahah
 
@tereško Are you implying that you are not a web browser?
Do you not browse the web?
 
@RonniSkansing in input I must use ' ' right?
 
@JavaFan no, you can use either one. But you should favor single-quotes, when you do not need to interpolate variables
 
11:21 AM
Going out in the suns, have funs (=
 
11:33 AM
same ... well ... not for fun, but shopping
 
user6845426
hello o/
 
12:51 PM
what do you call a class that retrieves a value from storage, generates and stores a new one if there is none?
storage and generator are separate classes ofc, this one just ties everything together
 
@Patrick Cache?
 
@MadaraUchiha it for csrf tokens. would cache be appropriate there?
 
Hmm, probs no.
 
1:08 PM
@Patrick Are CSRF tokens still relevant? I think all modern browsers send an Origin header that can simply be checked.
 
@kelunik no idea tbh. But lots of people have to support old browsers, so I think covering that in the book won't hurt
all those companies stuck with old IEs...
 
@Patrick They simply need a punch in their face saying you just can't use this site.
 
@kelunik what if you are a developing an internal site for such a company? :D
csrf is still in the top 10 owasp.org/index.php/Top_10_2017-Top_10
 
@Patrick I didn't say let them silently pass.
 
1:19 PM
@Patrick It doesn't matter what the RFC actually says, but what browsers do, but I'm not sure what they do.
@Jimbo How was your talk?
 
2:00 PM
@kelunik Five 5* ratings ;) here
I think I swore at the audience a bit too much, at one point I called them all bastards
Worked, though
Note to self: next time, drink fewer espressos before talk
 
@Jimbo you also got lucky, that nobody in audience identified as flower petal
these days you can't be too careful
 
:D
I can identify as what I want
 
it only takes one such fuck for you becoming a public enemy on twitter, getting doxxed and your address being sent to the friendly antifa people
sleep tight
 
My thoughts go that I'm on an island and I'm not bothered
 
@Jimbo +1
 
2:08 PM
Thanks to you and @DaveRandom for clarifying a few of the points on event loops and streams
 
@Jimbo Do you understand enough now to do the next talk based on Amp? :D
 
Absolutely not. I need to go through Chris' event loop again to properly understand it. I suspect I need to play with streams myself to get that
His promise stuff completely threw me off. I then need to understand that on it's own
 
I haven't had a look at his repo yet, where did you stop?
 
When he introduced promises
 
2:45 PM
!!dad
 
I bought shoes from a drug dealer once I don't know what he laced them with, but I was tripping all day
 
@Trowski ping
 
Is this the krusty krab?
 
No, this is Patrick
 
2:56 PM
reported
 
@littlepootis Ignored.
 
3:07 PM
@Patrick I just call everything that ties those layers together a repository.....it might not be completely accurate but it covers most things.
 
@kelunik Are these identical? "I haven't had a look at", "I haven't looked at"
 
@Shafizadeh in this context they're interchangeable yes
 
I see, thx
 
@kelunik pong
 
18 hours ago, by kelunik
@bwoebi @Trowski If you're ok with the docs format, then I'm going to convert byte-stream to a Jekyll site, too.
 
3:15 PM
@kelunik Yes, they look very nice.
 
while cleaning some stuff in the "computer parts" corner of my room, I found some old memory stick of no less than..... 64 mb!!!!
 
And I've solved the backpressure issue with parsers, I think it's easy enough: github.com/kelunik/streaming-json/commit/…
We just need to document that.
 
@FélixGagnon-Grenier that rises some uncomfortable questions about how often you clean that room
 
@kelunik Yeah, I thought there would be an easy way to do that without complicating Parser. I agree that documenting that with an example would be very helpful since it's not immediately obvious.
 
preg_match_all('/(?:\D+|<\d+>)*[!?]/', 'foobar foobar foobar', $matches);
echo "There are " . count($matches) . " matches.\n";
var_dump($matches);
Output is:
There are 1 matches.
/projects/danack/github/ReactTutorial/test.php:9:
array(1) {
  [0] =>
  array(0) {
  }
}
.....why is the array set like that?
@FélixGagnon-Grenier ebay it.
 
3:24 PM
@tereško heh, indeed ;)
@Danack oh... I seriously thought of just garbaging it, but if some crazy other me can buy it, I will indeed ebay it :)
 
there was preg error btw - Backtrack limit was exhausted! - but I would have thought the array wouldn't contain any entries, rather than one stupid one
 
@Trowski Should we already start redirecting the older docs where new docs exist?
 
user6845426
3:41 PM
Any Twig gurus here?
 
> Don't ask to ask, just ask. Username auto complete is tab, not enter.
 
4:03 PM
@kelunik v1 docs? No, I'd say lets tag v2 and new versions of all the other libs before redirecting the docs.
We're pretty close to doing that I think.
 
4:19 PM
I think we have to redirect them from the amphp.github.io repository anyway.
 
4:35 PM
@Trowski Should we have something like github.com/amphp/artax/blob/… in amphp/byte-stream?
 
 
1 hour later…
5:42 PM
guys, do you know what's Ramadan? In other word, have you a religion thing which shouldn't eat anything in some hours per day for a month?
 
Yes
It's called diet
 
I'm participating .. here wake them up.., tough I'm christian.. I hope Jesus be happy with me
 
kinda :-)
 
@Shafizadeh yes, there is some fasting supposedly associated with Easter (that's in spring), but fast majority of people ignore it
 
great .. so all of you know about it! good
 
5:46 PM
I strongly suspect it was made up to reduce food rations for peasants in the spring, when the stored food is running low
 
are you moeslim btw?
@loading...
you nick fools me once..
 
@tereško mind blown
how fucking brilliant. using religion to manage people
 
who would have thought :D
 
@shafizadeh your nick name is shown as "loading..." I'm not joking hahahaha, how so?
 
5:52 PM
@tereško nope ... it's actually a spiritual month which gives people a sense of closeness to God. Also tries to make us able to understand impecunious people by being hungry in 2/3 of day.
@Plain_Dude_Sleeping_Alone really? I didn't aware that!
 
@Shafizadeh in the western countries there is very little trust for clergy
 
sadly yes. I know
 
and I know what it is officially supposed to do
@Shafizadeh well ... we know that humans are not perfect. There is this joke about priest telling their congregation: "Listen to my word and don't look at my works"
 
:-)
 
and that's an oooold joke
think: 400+ years
 
5:56 PM
oh
anyway, that's really odd for me, how some people can live without believe in God!
That's actually impossible ..!
 
@Shafizadeh I would estimate, that it's at least 70% regulars in this chat room are either atheists or agnostics
 
@Shafizadeh, well the other sides also having hard time believing that you actually exist
 
bob
hey people, anyone familiar with the no-framework-tutorial by PatrickLouys? I'm stuck on the "dispatching-to-a-class" section.
 
yeah, we're pretty familiar with it. what exactly are you having problem with?
 
@tereško yes almost, but what's their motivation to awake every morning? without believing in God, everything will be meaningless
@Plain_Dude_Sleeping_Alone You know, I don't know English very well, and your sentence are hard for me to understand :-( sorry
 
6:01 PM
@Shafizadeh that is... a very narrow perception. just because you don't find any meaning other than that, does not allow you to decide for every human that other reasons are meaningless.
@Shafizadeh it means that we can't believe that you are actually serious ;)
 
bob
@FélixGagnon-Grenier It says you need to make a small refactor to the Bootstrap.php. that's the part i'm stuck on
 
@FélixGagnon-Grenier you are right
 
@Shafizadeh thanks for saying so, and sorry, I got a bit... heated on that :)
 
;-)
 
@Shafizadeh well .. lemme give you a different meaning for you: You are made of stars that died billions of years ago. Every atom in your body was forged in those stars. You are universe that is experiencing itself.
 
6:03 PM
@Shafizadeh, I mean atheists also wonder that why would we believe to such God
 
@tereško <3
@bob yes, and just after it gives you the code. you can copy paste it.
replacing only that precise part of course
 
bob
@FélixGagnon-Grenier yes, i've tried that.
 
@Plain_Dude_Sleeping_Alone yes, everybody has his own idea .. something like what @tereško said :-)
 
@Plain_Dude_Sleeping_Alone that's too off topic for this room.
 
@bob do you understand, what is actually going on at that part in the bootstrap process?
 
6:05 PM
@Shafizdeh, yeap
 
bob
@FélixGagnon-Grenier yes. but i don't know what to replace. that i'll admit
 
@bob cool! so, what exactly is not working, are you seeing an error?
 
@bob can you put in gist.github.com what you have right now?
 
and let people choose/believe things on their own we've to respect it, anyway see ya, I've to go sleep.. , tomorrow I've to stare at my pathetic non programmer boss.
 
bob
6:08 PM
@FélixGagnon-Grenier pastebin.com/NsbJd8dd, I've just pasted it in. I just can't see where the case could work.
 
hmmm.. ok
so. please read the php documentation for switch cases
 
@bob soooo ... you just copied bits of code
 
you just put the case in there, it needs to be in a switch case. that script produces an error, but you need ini_set('display-errors', 1); to see them
 
bob
@tereško well spotted...
 
we really need to make a proper newbie tutorial
 
6:10 PM
yeah.
 
bob
@tereško yes.
 
@bob what do you want to make?
 
bob
@tereško Nothing, i'm just tired of not knowing what the fuck i'm talking about. so i'm punishing my brain to learn this shit.
 
I am getting a feeling that you attempted to jump a level or two above your current skill ceiling
 
bob
@tereško yes, I have that feeling too.
but hey i got this far and it was working. just lying to my self that copying shit is an achievement.
 
6:15 PM
do you know how to make a single-point-of-entry page?
 
bob
@tereško yes
 
ok, explain to me, what it is then, @bob
 
bob
ok, the content changes but the structure of the page is the same.
 
hmmm... single point of entry, has nothing to do with the way content is actually presented...
 
bob
@FélixGagnon-Grenier then i was wrong i don't know.
 
6:19 PM
unless I misunderstand what you mean @bob.
but yeah, if you figure something about html, and changing the content in a paragraph, that's not what it is.
 
@bob that sounds like "prequel" version of it
 
bob
@FélixGagnon-Grenier no, that's not what i meant
 
@FélixGagnon-Grenier he's basically switching the stuff inside <body>
 
hmmm. right.
 
bob
@tereško i set up Xampp, downloaded php 7, composer and then followed the tutorial.
 
6:21 PM
6 mins ago, by tereško
do you know how to make a single-point-of-entry page?
this was completely unrelated to any tutorial
 
bob
@tereško ah ok, i didn't realise.
 
I don't think I will be able to help you .. blame the person who said to use that tutorial, because now you are probably more confused than before reading it
 
bob
@tereško not really. It's been making sense up until this point. but never mind i'll figure it out.
yeah think i got it. thanks for your help.
 
@tereško No surprise there
re said tutorial that is
 
wat? you sound even more drunk than normally :D
o/
 
6:36 PM
o/
Well I knew exactly this was going to happen :P
 
It's no use when people are trying to start to give them this. It's just counter productive
 
\o
 
o/
 
bob
6:39 PM
@PeeHaa any other suggestions?
 
@bob get a book about PHP
a proper book
something without "and" in the title
 
bob
@tereško can you share the title of a 'proper book'?
 
bob
@Linus without and. . .
 
6:44 PM
@Linus took me a second to realize the currency was not what I expected. for a second there I was "YO WTF!!! I START WRITING PHP BOOKS AND SELL THEM 700$ RITE NAO"
 
Then i will go with php.net docs in html format :P
@FélixGagnon-Grenier opps sorry for that i just searched on local amzon
 
don't be sorry, it was a funny moment ;)
 
:p
 
mornin
 
6:46 PM
\o
 
@FélixGagnon-Grenier yes I know :( If you feel like fixing it I am 80% there
Willing to pass it on to you :)
 
@PeeHaa hmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
brb smokes
 
@FélixGagnon-Grenier Go finish it github.com/PeeHaa/php-net-tutorial
 
6:54 PM
@PeeHaa There is nothing about classes, inheritance, interfaces, traits, closures, callabels, type hints, strict_type mode - there is a lot todo
 
@PeeHaa IIRC, it has been last updated 3 years or so ago :D
 
@brzuchal It's not a replacement for the docs... it's a tutorial. Meaning new people will look at it
@tereško 2.5 years to be exact :P I am bad i know
 
user6845426
Could someone point me to a good tutorial for creating templates using Twig template engine if possible. I've looked through the docs which go into details but i'm still not sure how to even structure pages using the engine. Thanks
 
@PeeHaa Why do you assume that new people are not looking for information about OOP
 
Because I am sane
There is no reason for someone new to even look into OOP
Also somethign like that cannot possibly be captured in a tutorial
 
6:58 PM
 
Yes, but I think you missed the word coming after OOP
> classes, inheritance, interfaces, traits, closures, callabels, type hints, strict_type mode
 
00:00 - 19:0019:00 - 00:00

« first day (2416 days earlier)      last day (2526 days later) »