« first day (2124 days earlier)      last day (2824 days later) » 

12:32 AM
is it bad practice to have an interface that requires __invoke or other magic methods?
 
1:12 AM
@bsapaka If it relies on __invoke it wouldn't really be an interface, now would it?
An interface is like an agreement between two parties. It supplies an enforcable contract that they' agreed on in advance. If there's no sensible way of enforcing that contract than the interface is pointless. There's no way to get two classes to agree on __invoke magic in advance, unfortunately. So there's no way to sensibly enforce that contract.
Unless the only point of the interface is that they implement a magic method. In which case, sure.
 
 
2 hours later…
3:35 AM
moin
Magical contracts are valid
 
morning
 
4:34 AM
do you guys think it's important to store datetime to millisecond precision?
 
5:06 AM
@Andrea don't know. Real usage of soft/weak refs in php is quite limited, I never faced such problem until start embedding v8 into php (github.com/pinepain/php-v8).
The problem comes when I want to wrap v8 object representations and pass them back and forth between php and v8 runtimes. It is not possible to connect v8 object representation and php objects that will refers to it in a weak manner so that when v8 object can be GCed by v8, PHP object can be also GCed and vice vers. It even sounds bit weird.
 
posted on August 09, 2016

New Cyanide and Happiness Comic

 
@andho that depends entirely on what you intend to do with it. most people dont need subseconds
 
@Gordon most probably will be using it for conflict resolution during data synchronization. Keep coming back to the question of why php DateTime still doesn't provide that info. The class itself supports milliseconds. But if you just create a DateTime object it doesn't have it.
 
> start embedding v8 into php
D=
 
!!rebecca
 
5:18 AM
@Linus Only 2 days, 18 hours and 41 minutes left until Rebeccaday, OMG!
 
> [A]ny application that can be written in JavaScript, will eventually be written in JavaScript.

Makes sense to embed v8 then XD
 
5:43 AM
> using it for conflict resolution during data synchronization
If that's the only reason, then no
Doesn't matter how deep down that road you go, there is always the question of "what do I do when I hit a duplicate"
And yes, the fact that DateTime doesn't have a usecs component by default sucks a little, but there are good reasons for it (which I don't have time to discuss now but I can a little later if you are still about)
suffice it to say that giving people 6 decimal place values when the actual resolution is unlikely to be much better than ~20ms is going to result in a lot of confusion and bug reports. If your application is that time sensitive, PHP is not the language for you.
 
6:05 AM
@andho yeah, you have to create the DateTime instance like this DateTime::createFromFormat('U.u', sprintf('%.f', microtime(true)))
 
!!rfcs
 
Sorry, but we can't have nice things.
 
damn, @Jeeves, you just killed my belief in a blue elephant
 
:P
 
!!rfcs
 
6:11 AM
Sorry, but we can't have nice things.
 
@PeeHaa why it is so ^? github.com/Room-11/Jeeves/blob/…
 
!!rfcs
 
RFC id required
Sorry, but we can't have nice things.
 
!!rfcs search
 
Nope, we can't have nice things.
 
6:32 AM
@DaveRandom yeah I should be using javascript XD I would like a blog post about the reason if it's interesting enough. Otherwise no.
I'm going with millisecond precision doesn't matter for synchronization, cox either way you need to provide a strategy for conflict resolution.
 
6:47 AM
@andho Javascript suffers the same issues with resolution - commercial hardware clocks just aren't that accurate (because they don't need to be)
 
Wes
 
make it stop
 
\o
 
@PaulCrovella I assume you are talking about the Genesis I am playing very loud, in which case: No
 
@DaveRandom No, I'd never interfere with your dedication to mom-rock.
 
6:55 AM
Good, because I'm pretty sure they can hear this on the other side of the Atlantic, and that's the way it should be
 
I found a sound in the house one day - if you know who lost it, I'll give it away..
 
Guys, can you help please with this one?
`$input = 'Shop (Products)';

$regExPattern = '???'; # How to strip everything inside brackets including brackets themselves?

echo preg_replace($regExPattern, '', $input); # Should be "Shop"`
 
What if the input looks (like) this?
or (like) this?
i.e. do you want to strip all brackets or only if they are at the end
 
Wanna strip them at any position in the string
 
OK. What have you tried?
@HabibRehman Listen to Incubus. That's generally good life advice for everyone.
Listen to this first though
 
7:11 AM
I'm not good at regexes, but still I tried this `~((\w+))~. Honestly I don't know what else to try.
 
what does this userland means php.net/manual/en/userlandnaming.php?
 
@Yang that's a pretty good try :-)
There are a couple of things you missed - firstly, brackets won't match literal brackets, they are groups unless you escape them with \
And secondly, you very probably want to match non \w chars inside the brackets (like spaces)
@Linus It means symbols that you name, i.e. those that are not built in to PHP
 
@pinepain hmmm no idea. Maybe wiki was slow?
!!rfcs
 
Sorry, but we can't have nice things.
 
and thirdly you want a lazy quantifier rather than a greedy one
 
7:14 AM
odd
 
@DaveRandom Well, sounds like you got it. So how the pattern should look like?
 
HTTP/1.1 200 OK
Server: nginx/1.4.6 (Ubuntu)
Date: Tue, 09 Aug 2016 07:14:31 GMT
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
X-Powered-By: PHP/5.5.9-1ubuntu4.17
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: DW7fa065a06cb74b536c124cfbe56ac6d3=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/; secure; httponly
X-UA-Compatible: IE=edge,chrome=1
 
@DaveRandom thanks
 
7:15 AM
@Yang I would go with ~\s*\([^)]+\)~ - please make sure you understand it before you use it, I'm happy answer any questions you may have about it :-)
 
or something like \(.*?\)
 
Yeh or that
But iirc character classes tend to perform better on long input (less backtracking)
Specifically in PCRE than is
 
@DaveRandom That's nice. Ty
 
good morning
 
@DaveRandom nah, the backtracking is effectively the same.. only difference is yours requires something between the parentheses (+ vs *)
also yours is matching leading spaces... which is probably desired though not specified
 
7:20 AM
I'll certainly admit that .*? or .+? would be more readable
 
@Yang if you want more info on what we're talking about (lazy vs greedy) see regular-expressions.info/repeat.html#lazy
 
In fact, basically just read that entire website like 30 times @Yang (which I have probably done by now)
 
it's where you got the note about backtracking, but it's not actually an issue with pcre
 
I thought I'd got it from somewhere, but there are so many things that I find out I've basically just made up that I'm rarely confident :-/
There's a ridiculously big .txt doc somewhere on the PCRE website that explains a bunch of internals related to that kind of things as well
 
@Yang if you want a great resource pick up amazon.com/Mastering-Regular-Expressions-Friedl/dp/0596528124 - it's probably the best-written technical book I've ever read
 
7:28 AM
Also Jan Goyvaerts (the guy behind regular-expressions.info) has a couple of tools that are pretty cheap and really worth the money
 
@DaveRandom this one? pcre.org/pcre.txt - it's awesome
 
I still use EditPadPro as my text editor of choice
 
Anonymous
moin
 
@PaulCrovella yeh that
It's really interesting but also quite dry
 
@DaveRandom it's also the only .info site I've ever recommended to anyone
 
7:30 AM
inorite
 
Hmm incubus
 
Hmm, I still need to write a blog post why url matching with regex is hard
 
@Gordon if you require scheme then basically anything with a : is a url... if you don't then basically anything is is url
(there's your tl;dr)
 
@PaulCrovella url or uri?
 
@PeeHaa if you don't require a scheme then it's not actually a url, but in practice when someone wants to "match urls" they don't care as much
 
7:40 AM
Well yes, but isn't this not not true
> if you require scheme then basically anything with a : is a url
Isn't that talking about an uri instead?
I am going to need to find urls in my current project and I thought a simple https?{somemorechecks would suffice
 
@PeeHaa file://blah is a url
a url scheme can basically be anything preceding a : - there are well-known ones, and ones you care about, but all that is a subset of what's possible
 
moin
 
Anonymous
\o
 
Ekn
o/
 
7:47 AM
@PaulCrovella ugh damn you. You let me read up on how urls are defined
The whatwg is also fucking that up now
 
o/
 
@PeeHaa being right and being useful are two different things.. go with what you need.
 
Morning btw @all
@PaulCrovella I want to be both :p
 
you're in the wrong room for that
 
:D
 
7:52 AM
does my bootstrap.php looks sane?pastebin.com/Jbwa5jCJ
 
Anonymous
@Linus Why does environment need to be a globally available?
 
@Linus Other than the very inconsistent quoting of things (like WTF is this? define("PHP_PATH", realpath(dirname(__FILE__) . '/sources'));) .. I don't see anything odd.
 
@PaulCrovella there is a hidden assumption in "url" that it means anything a human would consider a domain name. There was a guy in here asking us how to linkify urls in some text. he had a horrible regex that would match http, https and ftp urls and google.com, but obviously also things like ha.ha or also missing.space after end of sentence and so on.
 
@JayIsTooCommon what i will do if i need to if i make my website offline then i can show appropriate message by setting enviroment =testing
 
Anonymous
Though, I would put db credentials elsewhere and pull them into Bootstrap.
 
7:56 AM
@PaulCrovella needless to say, he got the regex from SO and no clue what it does
 
@Gordon yep, hence 'in practice when someone wants to "match urls" they don't care as much'
 
@Oldskool those are paths where php source code are put.. why that's bad?
 
the scheme doesn't matter but the tld does, etc.
 
Anonymous
@Linus eh ok, but still - Put your db credentials elsewhere
 
@JayIsTooCommon that will be good
ok
 
7:57 AM
@Linus I know what it actually is, but I mean why use " for the definition and ' inside the path. It's very inconsistent.
 
@Oldskool so how can i do it?
 
@PaulCrovella so I figured a blog post could explain the intricacies of this.
 
@Linus Just pick one and stick with it, either quote stuff with " or with '. Dealer's choice.
 
@Gordon if you wrote a blog post about why "you're asking to match urls but you don't mean it" that'd be great
 
So either define("PHP_PATH", ... "/sources") or define('PHP_PATH', ... '/sources');
 
Anonymous
7:59 AM
@Linus db credentials or quotes? @Oldskool is just saying that you are mixing double quotes and single quotes. (if you don't need double, use single) :)
 
ok thanks :)
yeah will correct it
 
@PaulCrovella I'd argued that the scheme does matter btw, at least when it comes to matching http urls and no the whatever I recognize as a domain name
@PaulCrovella yeah, something in that direction is the intention
 
Anonymous
@PeeHaa mornin - see my ping?
 
Wes
does anybody have some reads about the possible performance tricks and optimizations for the handling huge aggregates? i need to fetch thousands of objects in memory because changes on an object propagate to its whole subtree (potentially thousands of objects)
 
@Gordon I wasn't precise in that. The scheme matters when it's http(s) [because that's what you really want], but the lack of a scheme might imply that [again, if that's what you're after]
 
8:04 AM
* Stumpled upon ' processwire2 '
 
I'd be happy to contribute to a post on that once you're drafted something
 
@PaulCrovella cool. I'll ping you once I got something… might be never though…
 
@Wes without knowing anything more: google "flyweight pattern"
 
Wes
i heard of that. never looked at it, though. checking
 
!!? flyweight design pattern
 
8:07 AM
Search for "flyweight design pattern" (https://www.google.com/search?q=flyweight+design+pattern&lr=lang_en)
• Flyweight pattern - Wikipedia, the free encyclope… - In computer programming, flyweight is a software design pattern. A flyweight is an object that min… (https://en.wikipedia.org/wiki/Flyweight_pattern)
• Flyweight Design Pattern - Flyweight design pattern. The Flyweight uses sharing to support large numbers of objects efficient… (https://sourcemaking.com/design_patterns/flyweight)
• Design Patterns Flyweight Pattern - Tutorialspoin… - Flyweight pattern is primarily used to reduce
 
in a nutshell: if many object share some properties, extract the properties into it's own object and share that between the objects. Something like Character.fontSettings. This way, you can do fontSettings.size = 42 and have that automatically applied to all Characters. Instead of foreach characters.setFontsize(42) and storing a separate data point.
 
@JayIsTooCommon Nope I did not
At least I TILled why e.g. file has three slashes :)
 
because the two initial slashes are actually pointless and the inventor of the url has decried them
 
I disagree that they are pointless
 
The rabbit hole is deep either way
I'm going to need more coffee @PaulCrovella. Thanks asshole
 
8:14 AM
I suppose they should be considered part of the authority portion though, in which case yes they are pointless for the file:// scheme
 
since we're all here - this is something I've wanted to drop
I've wanted to fork it to add a peehaa mode, but wasnt sure of the typical BAC
 
does file://./path work?
 
@PaulCrovella :P
 
Ekn
lol
 
Wes
i was thinking to do something like that, but i'm unsure about its effectiveness
 
8:16 AM
@DaveRandom yes
at least it should
 
Right, it should, and no other value for the authority actually makes sense, I'll grant you that much
Some of the best and worst code I've written was while thoroughly intoxicated
 
Ekn
!!? hash consing
 
Search for "hash consing" (https://www.google.com/search?q=hash+consing&lr=lang_en)
• Hash consing - Wikipedia, the free encyclopedia - In computer science, particularly in functional programming, hash consing is a technique used to s… (https://en.wikipedia.org/wiki/Hash_consing)
• Type-Safe Modular Hash-Consing - LRI - Hash-consing is a technique to share values that are structurally equal. Beyond the … This paper i… (https://www.lri.fr/~filliatr/ftp/publis/hash-consing2.pdf)
• Hash consing - HaskellWiki - Hash consing. From HaskellWiki. Jump to: navigation, search. Migrated from the ol
 
@DaveRandom Picked up the car yet? :)
@Wes Good show last night! (saw Wes Borland live on stage yesterday ;-))
 
Although I will say this much: cocaine coding is consistently bad. I had to touch a project of mine from a couple of years ago and it reads like it was written on cocaine - shitloads of corners cut and loads of things that were clearly in the mindset of "THIS IS A GREAT IDEA!!!!1111oneone" and are just awful
 
8:19 AM
heheheh
 
@Oldskool It's being delivered to the office "some time today", will let you know though :-D
 
how about weed?
eheh
 
That's like booze I think, some of it is terrible and some of it is great, there's not a lot in between
 
btw, if someone wants to hire me for a full-time job (an actual job, not this contracting crap) I'm available
5
 
Want me to pin it?
 
8:22 AM
and competent, if that matters
 
nvm chris already did it :)
 
Wes
@Oldskool :o
 
Maybe it was a ghost.
It was probably a ghost.
 
Same thing
 
it isn't enough @PaulCrovella
 
Wes
8:23 AM
as soloist or with limp?
 
you have to publish your github, linkedin etc.
 
@Wes With limp. I guess they ran out of money and decided to do a little "restock" tour ;-)
But was awesome either way.
 
@AdilIlhan I'm not on linkedin. My github is at github.com/pcrov - it's sparse, but again competent.
 
8:25 AM
Wow that web on peyote is actually pretty good
 
@Gordon I've always been intrigued by this, it so obviously tells you nothing useful whatsoever, and is clearly the kind of idea that would seem brilliant while stoned
 
I don't own the bulk of the code I've written :(
 
I would have expected the speed one to be just fine and done in half the time though :)
 
Wes
@Oldskool i lost interest after the latest crappy albums
 
> Spider is standing proud with a cape held in front of his chest.

Spider
(Yelling) “I can do anything…..for I…
Music plays a fanfare as spider opens cape to reveal the initials LK printed on his chest
am the lizard…KING!”
hehehehe
 
8:27 AM
@DaveRandom there is a whole wikipedia article on the effects of psychoactive drugs on animals. I am not sure what the point of the research is.
 
Wes
actually gold cobra wasn't that bad, but compared to their first albums it's utter crap @Oldskool
 
:D
 
@Gordon amusement for stoners, I assume is the point
 
8:29 AM
PHP is the Lizard King because it can do anything!
 
@Wes Luckily they mostly played older stuff. The only classic I missed was Nookie. But My Generation, Rollin', My Way and of course the closing act of Break Stuff were all there.
 
@Gordon except interface with gtk.. the lizard king could never quite manage that
 
PHP is the Lizard King because it can do anything!
 
Morining '11
 
8:30 AM
@Wes Audience went crazy on the last one, whole dance floor was jumping, screaming and moving from left to right. It was a mess xD
 
@Jeeves my experience with that quote is that most people dont know it's a Jim Morrison quote though :)
 
Wes
:D
the best stuff is from first album though
 
@Gordon I'm 32, not 168
 
@Wes give me L.A. Woman or give me death
 
@PeeHaa being young doesnt free you from learning your pop culture quotes ;)
 
8:32 AM
I always read phphants as PHPants
 
^ I just read the same
bad name
 
@Gordon :-)
!!should parsing email bodies be part of an nntp library or a separate library?
 
@parsing should a separate library.
 
lol
 
hehe
 
8:33 AM
you have to ask?
 
We should check that against the pingable list
 
Yeah nice addition/fix
 
Wes
@PaulCrovella i usually like those years music. but doors. so boring...
 
@PaulCrovella You tokking to me?
 
@PeeHaa I like discovering references like this. I was totally thrilled when I learned that Ruk's riddle in The Last Unicorn was basically a hat tip to Lewis Carrol.
 
8:35 AM
@PeeHaa I know, you always have to ask. It's probably for the best.
 
Wes
@Oldskool so fred still makes the audience sing for him? he lost all the voice.. or he is just lazy
 
:P
 
Wes
now sings like they are squeezing his testies...
 
@Wes Nah, he sang pretty much most of it on his own. Sometimes he let the audience have the floor, but that just happened in like 1 or 2 songs for a few lines. Like "keep on (audience) ROLLIN ROLLIN ROLLIN!" and then he picked it back up.
 
@Wes if you've ever done serious hallucinogens, the doors are a great middle ground between the beatles ("yay, everything is lovely") and led zeppelin ("oh shit, this is a bit too intense")
 
Wes
8:37 AM
lol
 
@PaulCrovella I am more a modern music kind of guy when tripping :)
 
I always felt that Hendrix version of All Along the Watchtower sounds very trippy
 
@PeeHaa if shit goes sour, try beatles - they were my consistent backup both while tripping and while babysitting, and they never failed
I should add this to my resume
 
:D
ok I'm done reading about uris and the clusterfuck that is called standards. Moving on to mail parsing \o/
 
@PeeHaa so by now you'be abandoned all hope, which should help
 
8:47 AM
Yay mails with accept encoding headers. This is going to be SO MUCH FUN
How does that even work for mail?
 
nothing works for mail, so you're good
 
So I have noticed :)
 
For non-secure hashes, md5 will still be fine, aye?
 
Sweet, just using it for some caching
 
8:49 AM
if you just want to do something like fingerprint a file, md5 is fine
sha1 is arguably better, but who really cares
 
hahahahah
> declined - Using standard flags helps us prioritize problems and resolve them faster. Please familiarize yourself with the list of standard flags: see What is Flagging?
 
9:21 AM
!!should foo bar or baz
 
@foo should baz.
 
Morgen
 
!!uptime
 
@DaveRandom I have been running for 12 seconds, since 2016-08-09 09:21:51
 
!!should foo bar or baz
 
9:22 AM
foo should bar.
 
!!should daverandom stop fucking with jeeves or not?
 
@DaveRandom should stop fucking with jeeves.
 
Sorted @PeeHaa
 
awesomesuace
 
waddup
 
9:31 AM
8 messages moved to bin
 
LOL
censorship!
 
:P
 
@PeeHaa wait, what?
 
Wes
they just told me a funny thing. this guy i work for always sends email and writes docs all in uppercase. but he doesn't use caps lock, he holds the left shift key pressed with his little finger for the whole time he's typing
 
@DaveRandom That was my reaction too
 
9:37 AM
@DaveRandom He broke the github -_-
 
Someone must have just lifted some HTTP server message encoding and dropped it into a mail encoder, because Accept-Anything makes no sense for email
 
@Wes CAPS LOCK IS FOR PUSSIES!
real men stretch that finger muscle and use shift :p
 
Wes
lol that must be super hard
 
"stretch that finger muscle" definitely sounds like a euphamism
 
:D
I think that depends on how twisted your mind is.
But in your case, yeah that's probably going nasty places.
 
9:40 AM
@Oldskool That's... what she said?
 
@DaveRandom Will check how often it happens once I have it all in the db
 
@DaveRandom Who? @Jimbo 's mom?
 
Hii guys :)

    var regExp = /\(([^)]+)\)/;
    var matches = regExp.exec("I expect five hundred dollars ($500)");
    alert(matches[0])// returns ($500)

But i want "I expect five hundred dollars" its in javascript
 
@PeeHaa oh wait is this getting stuff from news://?
It does make sense there, and you can ignore it for what you are doing
 
@PraveenKumar This is PHP room not JSHeathen room
 
9:41 AM
@DaveRandom Yes it is
 
Just ignore it then
 
@DaveRandom Why does it makes sense there? Isn't it just all email messages?
 
Mornbo
 
Morning Jimbo, we were just talking about your mom. Good timing.
;-)
 
9:42 AM
@PeeHaa You can send MIME messages directly in to the news server, and you are never doing that. It's just the server telling you what it would accept if you did that
 
oh tnx
 
@salathe That's a new one!
 
@DaveRandom If I want to add the ability to send messages from the gui can't I do just that then?
 
@Jimbo I already know that, there is no one there(in js room) so i asked here, I get alll my answers from this room since 2 years ;)
 
9:44 AM
@PeeHaa Possibly but unlikely the server would actually accept them, I'd expect it to be configured to only accept stuff from email (which will be vetted by a spam filter). The protocol allows you to do it, I would hope that the server config does not.
 
kk tnx. Will give it a try and see what happens nonetheless :P
 
yeh, you'll have to read the protocol spec for precisely how you do that, remember that news:// has actually been around for longer than the internet has :-P
 
@PraveenKumar /(^\w.*?)\s(/
 
@jimbo see i got this :)
@AdilIlhan Thanks :)
 
@DaveRandom I like my technology mature
:P
 
9:46 AM
That's definitely what she said
 
I knew you couldn't let that assist pass :)
 
That's what she said next
 
:P
 
/me leaves before this gets too much further
 
It's probably for the best :D
 
9:52 AM
@DaveRandom That's what she said.
 
Hey guys, I want to create a dynamic multiple model form. Basically, it will begin with one block of a model and contain a "Add Another" button which will add another model to the form dynamically. Im using yii2 advanced.. please anyone help me in this..
 
What's a model?
 
^ that
 
its nothing but a form
 
Get out (Only joking) ;-)
 
9:55 AM
I'm guessing Yii has yet another bizarro definition of that word
@Jimbo now now...
 
Not srs
@SalmanRiyaz So, a form is a model, so you want to create a dynamic multiple form form?
 
"model is a form" ... this is somewhat impressive level of wrong
 
I suspect this is one of those things that needs someone who actually comprehends that framework to answer
 
@SalmanRiyaz You might want to ask a proper StackOverflow question :-) We don't have many Yii users in here
 
9:57 AM
Also this sounds like a client-side i.e. JS (i.e. not PHP) issue?
 
@tereško is an avid Yii user
3
 
hmmm ok @Jimbo
 
@Gordon fuck you too
 
And I agree, a question with a "here's what I have at the moment" minimal code sample would be a good start @SalmanRiyaz
 
@tereško I did it all for the stars!
 
9:59 AM
@Gordon that's basically how BuzzFeed works
 

« first day (2124 days earlier)      last day (2824 days later) »