« first day (2749 days earlier)      last day (2203 days later) » 

1:01 PM
@MadaraUchiha I have like 4000 sites, that I want to take a screenshot of. And I need something async. So, I can get results quickly. And when all the screenshots are taken I want to resize them into thumbnail size using imagemagik convert command.
 
Wasn't even entirely directly aimed at you. More ranting towards par of the community who thinks they need to use broken things because somebody wrote a blofpost about it once without thinking things through a.k.a. the JS model
 
... did I miss the part where Laravel decided to name something "makefile" to make php devs feel like badass c++ programmers?
 
Why the response in ajax is empty string? I checked the variable I return with xdebug and its not empty.
I return variable $buffer that is long string of html
but in ajax response
it logs ''
 
@mega6382 I see 2 main functions
 
@FélixGagnon-Grenier Not just laravel
 
1:02 PM
One that accepts a URL and returns either a local path to a screenshot, or a buffer with screenshot image data
 
@MadaraUchiha And I see a loop with 2 nested callbacks :P
 
blofpost is a good word
 
And one that accepts a local path or a buffer, resizes it, and returns a new local path or buffer
Both async
You can then compose the two and orchestrate it however you want
 
@PaulCrovella :P
 
(i.e. wait for all screenshots then resize all images, or resize an image as soon as it's ready, while the others are being processed)
 
1:04 PM
@MadaraUchiha Yes, and that is how it was with the phantomjs. But I got EMFILE error with that. Cause it won't run directly in node and I had to make a separate call with phantomjs.exec
@MadaraUchiha I am trying to do this 'resize an image as soon as it's ready'
 
This is how I'd imagine the entry point to be then:
 
If I echo the php variable then I get it in ajax response, but if I return it then its empty string. Why?
 
Anonymous
@Rudolph return !== echo
 
const urls = [/* ........ */]; // alternatively, from JSON or wherever

(async () => {
  const resizedImagePromises = urls.map(async url => {
    const screenshot = await getScreenshotFromUrl(url);
    const resizedScreenshot = await resizeScreenshot(screenshot);

    return resizedScreenshot;
  });

  const resizedImages = await Promise.all(resizedImagePromises);

  // do something with resizedImages if you want, surround with try/catch/finally for stuff
})();
 
i know
but shouldnt what i return be in ajax response?
 
1:08 PM
@MadaraUchiha OK, cool great. Let me check it out. thanks
 
All that's left for you is to implement getScreenshotFromUrl() with the help of Puppeteer, and resizeScreenshot() with a promisified version of child_process, or gm.
 
Anonymous
@Rudolph share your code in a paste service for help - But if you're referring to the literal return then no
 
712
A: How to pass variables and data from PHP to JavaScript?

Madara UchihaThere are actually several approaches to do this. Some require more overhead than others, and some are considered better than others. In no particular order: Use AJAX to get the data you need from the server. Echo the data into the page somewhere, and use JavaScript to get the information from...

 
@JayIsTooCommon [citation needed]
 
Anonymous
 
1:13 PM
@MadaraUchiha btw my url list is a json with an array of objects like this: {"id":"2","siteUrl":"http:\/\/example.com","outputImage":"\/path\/to\/the\/scre‌​enshots\/directory\/example.com.png"} how will i use these in urls.map()?
 
@mega6382 Array.prototype.map
Similar to PHP's array_map
With node, you can require() JSON files directly and get them as JS objects.
 
Sep 2 '16 at 19:34, by DaveRandom
or you could just kill yourself
 
Okay, now I see. But still, as to where I pointed to in the answer: *"The programs mount and umount traditionally maintained a list of currently mounted filesystems in the file /etc/mtab. This real mtab file is still supported, but on current Linux systems it is better to make it a symlink to /proc/mounts instead, because
a regular mtab file maintained in userspace cannot reliably work with namespaces, containers and other advanced Linux features."*
This is from the manpage. It names "containers" explicitly, I guess that is one of the shared contexts of containers w/ the host system and you don't want to see it there then either.
 
@hakre so what's the difference between mtab and fstab?
I'm sure I will shortly regret asking that question
 
Wes
bank account gets blocked when my id card/driving license expires. how nice
 
1:18 PM
@Wes really?!
Thats so stupid
 
Wes
assholes -__-
 
@DaveRandom fstab is the table on the file-system (fs) and mtab is in memory - but that is a guess. man mount talks about these in greater detail.
 
> $ man mount
giggity
 
starting to think the only solution to upgrading my legacy codebase is nuking it from the sky
 
Wes
no
that never works
 
1:25 PM
@Tiffany We are trying to refactor a codebase, the project is named "Project Phoenix". Cuz they want to burn everything down and start again. :P
 
static function All($class)
{
  eval('$all = '.$class.'::$all;');
  if ( ! $all )
  {
    eval('$all = self::findAll('.$class.');');
    eval($class.'::$all = $all;');
  }
  return $all;
}
13
 
/shrugs
 
Wes
holy shit
 
well yeah, nuke that for sure
 
sweet mother of bad practices
 
1:27 PM
good god
 
@Tiffany no.
 
god had nothing to do with that
 
so I need to figure out how to fix that...
 
There is no fixing that.
Just throw the server that is running on out the window
 
Wes
only napalm fixes that
 
1:29 PM
so that's in a class called ModelBase and pretty much everything extends from it one way or another
 
Wes
@Tiffany do you use phpstorm, right?
 
@Wes yes
 
And I thought, I write the worst code. :P
 
class Model extends ModelBase
class AdministratorBase extends Model
class Administrator extends AdministratorBase
(different files)
 
I don'T understand who needs eval to access global variables?
 
1:30 PM
Could someone do me a massive favour and modify the parallel example for artax github.com/amphp/artax/blob/master/examples/… and make it so that an new uri is added to the list of things to fetch. Basically I'm trying to port the site scanning tool I wrote with Artax version 1 - and I am just not getting the whole thing of returning promises.
 
Perhaps this code predates late static binding in PHP 5.3 and is a workaround for something similar?
 
Wes
this is your friend i.imgur.com/IeFdTrN.gif @Tiffany in case you don't know it
 
@Tiffany who wrote this code?
 
Wes
i'd advice not modifying existing functions, instead providing alternatives for them
 
@mega6382 developer from a local vendor
we contracted them like six years ago
 
Wes
1:33 PM
functions you want to get rid of can be marked as deprecated, but ultimately you don't want to remove them unless you have all static analysis working
that is probably the best thing you can do
make sure that static analysis works in any file
 
It should be possible to get rid of the evals. That would be one step ahead. But I really suspect this is missing late static binding, was not available that time (static keyword). stackoverflow.com/q/5197300/367456
yes, very good hint on the static analysis. works wonders for legacy code bases.
 
Wes
e.g. change this
$var = $x ? "foo" : "bar";
return $a->{$var};
to this
if($x){
    return $a->foo;
}else{
    return $a->bar;
}
 
my ultimate goal is to try and get this running on PHP 7.x, but figured I might as well try getting it running on 5.6 at least... there's an issue because Declaration of AdministratorBase::All() should be compatible with ModelBase::All($class)
 
Wes
get rid of all evals, and anything dynamic
 
otherwise some grep and sed magic and a vcs like git are not so bad as well.
 
1:35 PM
@Wes I'll take note of this somewhere...
@hakre when did "late static binding" come into practice?
 
Wes
if you can't do that you can use /** @var */ in order to enable type inference
and good luck :B that looks like an awful job to do
although i'd probably find it quite challenging... i am strange
 
@MadaraUchiha How does it look? pastebin.com/y1egtDVJ
 
@PeeHaa Is there any security implication if you only unserialize() data produced by serialize()?
 
@kelunik if you have time, I'd really appreciate it if you could help me out with chat.stackoverflow.com/transcript/message/42283934#42283934
 
On Unix we use process pipes, which can be accessed by just any process. On Windows we exchange security tokens, so no other process can bind to the TCP ports if it's fast enough. @PeeHaa
 
1:42 PM
@Wes phpstorm is still finding usage cases for All (I'm not used to it taking this long... usually finds all usage cases in a minute or two for other stuff)
 
@Danack Starting today, I have time, yes. :D
 
I started running it shortly after you sent the gif
 
Wes
@Tiffany but if static analysis doesn't work correctly it's not getting them all
but remember, don't remove anything unless you are absolutely sure you have a working alternative
 
yeah
 
@kelunik that's either congratulations or commiserations....
 
1:44 PM
so it's safe to say don't even bother adding tests to my code until I get all of this mess resolved?
 
@Danack First one, had the presentation for my bacheors thesis today. :)
 
@Tiffany adding tests is (part of) how you get the mess resolved
 
@Tiffany tests can help you ensure you resolve the mess without breaking BC
 
okay
 
ThW
@Tiffany without evals eval.in/995494 , still bad practice however.
 
1:47 PM
there's a use case for ??= :)
 
@kelunik Depends. It may be
 
@PeeHaa If you find any resources on that, please tell me, but otherwise I'm going to assume it's fine that way.
@Danack So you want an example for a crawler that continously adds URLs and makes concurrent requests?
 
well it depends on who serialized it.. or if you work hard enough, possibly when
 
The thing is unzerialize is basically eval
So if you have user input anywhere in the stack you may you open yourself to a world of hurt
 
@PeeHaa Any library that uses parallel can also use eval.
 
1:49 PM
That was not the point :P
 
@ThW is there a testing library I can use other than phpunit?
or I guess I could find an older version of phpunit
 
@PeeHaa Not really. If you serialize a string that contains user input, that doesn't make the serialized string user input to unserialize. You'll only have issues if the user can control the direct input to unserialize.
If what I said is wrong, please tell me and provide at least a resource for further reading.
 
Wes
i'd test only new code. if existing code is up and running then it probably works...
 
@Wes Unless you want to refactor that code.
 
@kelunik Many of the vulnerabilities in unserialize disagree
 
Wes
1:52 PM
she wants to get rid of it
rightly so :B
 
ThW
@Tiffany use the phpunit phars
 
@PeeHaa Have a link to one of them?
 
What was the last big one?
Pornhub?
Lemme think
 
@mega6382 Don't use the https module, it's too low level for your purposes
use axios from npm
 
Wes
yes ph
 
1:53 PM
(Or request-promise)
 
@ThW I have composer set up. phpunit 4.8 requires 5.3.3... I'm on 5.3.28... maybe I can upgrade to 5.3.3 without breaking stuff
oops, didn't mean to ping you on the testing library message, ThW... I had starting typing a message, then stopped... and didn't delete the reply part
 
> In all cases a parameter named “cookie” got unserialized from POST data
 
@MadaraUchiha mkay sure
 
Generally speaking, once a part of your code is "uplifted" into promise land, you want to stay in promise-land as much as possible
 
1:57 PM
@kelunik yes please. that's what the version of the app is doing with artax v1.
 
@MadaraUchiha Says someone from Israel. :P
 
ThW
@Tiffany I strongly suggest using Phive for tools, not Composer - separate tools and project dependencies
 
Thanks for the tip.
 
@mega6382 Ha! Didn't even think of that :D
 
@Tiffany 5.3.3 is older than 5.3.28
 
1:59 PM
@PaulCrovella :S
you are right. I was thinking 5.3.30 but there is no 0 placeholder, so it's 3, not 30...
 
@Tiffany Version segments are in base infinity
0.1 0.2 ... 0.9 0.10 0.11 0.12 .... 0.99 0.100 0.101 etc
 
Sorry was eating
@PaulCrovella Wasn't sure about that. Right
 
I hate how phpstorm works with networked drives
 
Anonymous
@PeeHaa fatty.
 
ThW
@Tiffany local copy + auto deployment works much better then directly using the network drive
 
2:05 PM
Wat?
It was my breakfast
 
Anonymous
F A T T Y
 
@ThW does that work with Windows? I'm working with a Windows server and I'm on a Windows box.
 
@JayIsTooCommon to the tune of youtube.com/watch?v=37wXKoe4L0M
@Tiffany git checkout <tag>
 
Anonymous
@DaveRandom :D
 
:O
 
2:08 PM
@JayIsTooCommon Shut up while I finish my food
 
Anonymous
typical
 
@DaveRandom I don't have the copy of Windows server to make a local VM
hmmm
 
@MadaraUchiha How bout now? pastebin.com/RBqkre8c
 
ThW
@Tiffany sure, I use it from Windows to Samba
 
it's just that it's a shift from how I currently do development. I'm not opposed to switching, but I have to find out from server admin if I'm allowed to create my own VMs with our version of Windows server, and then learn how to get the host and guest to work nicely. I still have yet to make a completed linux dev box at home.
I'm used to having dev boxes created on our VM cluster for me, and I set them up through there, but I'm limited to accessing them from the network.
shrug
 
2:21 PM
@MadaraUchiha also this gives an error await is only valid in async function
 
@Tiffany do you keep your codebase in git?
 
@DaveRandom yes
 
do you use tags?
 
no
 
2:24 PM
\o
 
@Tiffany That's the first thing that you should do, is start tagging when you do a release
 
!!should I do redis or sqlite
 
You should do redis.
 
What about both?
@JayIsTooCommon Done. For you info it was fries and frikadellen
 
21 mins ago, by JayIsTooCommon
typical
 
Wes
2:30 PM
is this summer or is it a trick
 
Stop fatshaming me
 
@Wes 28C here
so that is a yes
 
Stop summer shaming us damnit
 
^
all that shame
 
2:31 PM
@Wes 35C here
 
Just stopped raining again here
:P
 
^2 blame him now
 
Wes
18c here, still pretty summery
 
on that note, office time's up, /me finds home
 
Wes
\o
@FélixGagnon-Grenier temp in canada?
 
2:32 PM
o/
 
Only 26c here
 
around 10c I'd say
raining
 
Wes
aw
 
Anonymous
@PeeHaa what's a frikadelanej?
 
Anonymous
2:33 PM
that's called a sausage mate
2
 
Nope
 
Anonymous
you've had sausage and chips, you're just trying to sound swaggy
 
This is a sausage
 
Anonymous
lemme change to my mobile so I can see nudez..
 
Anonymous
i am disaapoint
 
2:35 PM
the file is literally named penis.png
 
Quick so I can delete it before people are offended by other dicks than you
 
I think I'm good
 
Anonymous
@PeeHaa i've already flagged.
 
:P
 
@PeeHaa does that sausage having icing, onions, and caramel drizzled on it?
 
2:35 PM
:42285573 Should've put the tag before the link :P
 
@PaulCrovella mayo and "curry" sauce
and onions yeah
 
Anonymous
> mayo and curry
 
Anonymous
are you having a giraffe ?
 
lol
 
Sounds nice. Burger sauce is just Mayo and ketchup, so why not curry?
 
Anonymous
2:38 PM
1 min ago, by JayIsTooCommon
> mayo and curry
 
@mega6382 Be glad I didn't tag it sfw :P
 
@Fabor because no, that's why
 
:P
While on the topic. This is also gooood
 
I bet it isn't
 
Anonymous
^
 
Anonymous
2:39 PM
that's from a manc as well, they eat kittens.
 
Anonymous
You forgot to cook it
 
And the proper way to eat it media.nu.nl/m/m1nxhfea8p6n_wd640.jpeg
 
Looks like you have experience there
 
Anonymous
fucking nsfw ahahahha
 
2:40 PM
Curry-ketchup is nice isn't it?
 
Anonymous
wtf @Fabor
 
@Fabor Much better than ketchup
 
Calling @Gordon for confirmation. Curry-Ketchup is delicious right?
 
Anonymous
@Fabor laravel.io
 
Currywurst FTW cc @Gordon
 
2:42 PM
more like curryBEST amirite
 
:D
 
I've had it with you people
 
Do something about it
I dare you
 
class Room11 implements GodwinsLawInvocationFactory {}
 
Hey @NikiC, no interest in taking up the RM role for 7.3?
 
2:44 PM
I nominate @Jeeves
 
hey guys, can someone explain me the difference between these two changelog entries:

```
7.2.0 float and double types supports both Big Endian and Little Endian.
7.0.15,7.1.1 The "e", "E", "g" and "G" codes were added to enable byte order support for float and double.
```
 
@PaulCrovella I second it
 
why are you packing floats?
 
Maybe he wants to take them with him on a trip?
Who are you to judge?
 
Float packer
 
2:46 PM
@DaveRandom for msgpack
 
That stuff is a complete clusterfuck, even on top of the obvious issues with passing float values across machine boundaries
hang on, I have a thing
 
inb4 @PaulCrovella comes again with a simple sprintf
 
@EugeneLeonovich to simplify this, can I assume that all you actually need is to be able to pass 64-bit (double) values in network byte order?
 
You know what all?
Fuck this shit
 
@pmmaga there's more important stuff for nikic to do ...
 
2:49 PM
/me closes IDE
 
and also, what PHP version support do you need?
 
@JoeWatkins I assume so, but I was curious since he hasn't replied to the suggestion
 
Anonymous
@PeeHaa ragequit
 
!!should I do sport or game?
 
probably hasn't read any of the thread
 
2:50 PM
You should do sport.
 
@PeeHaa for packing floats? no. nonononono.... no.
 
Let me try that again
!!should I game or do sport?
 
You should game.
 
yay
ok
@PaulCrovella :)
 
@DaveRandom https://github.com/rybakit/msgpack.php/blob/php7/src/BufferUnpacker.php#L512-L534
https://github.com/rybakit/msgpack.php/blob/php7/tests/DataProvider.php#L132-L147
it works on both 7.1.* and 7.2, but I didn't get what was changed between these releases
 
2:58 PM
@EugeneLeonovich basically it's available in all of 7.2 but only in 7.1 since 7.1.1, and they ended up with different release notes so it reads weird
 
@Fabor it's okay
 
Confirmed.
 
so it's safe to use e E g G starting 7.1.1 and above, 7.2 is not required, correct?
 
@EugeneLeonovich that code only seems to handle big-endian values anyway. Before the versions mentioned above, the only format codes available for handling floats were f (single) and d (double), which were always machine byte order (i.e. little-endian on x86)
 
Is there a way to cache ajax requests in wordpress? I have ajax pagination for related posts and want to cache them.
 
3:02 PM
@EugeneLeonovich should be, yes.
 
@DaveRandom correct, big endian is only supported order, I was more interested in the difference regarding float/double packing between 7.1.1-7.2, as I see two changelog records, which are basically saying the same thing, so I was confused
@PaulCrovella thanks for the confirmation!
 
@EugeneLeonovich yeh I don't really know why there are two entries there, they refer to the same change
 
@DaveRandom thanks
 
@DaveRandom fstab is devices mounted on boot. mtab is devices mounted right now. both of them are files.
 
3:22 PM
@Gordon from the brief reading I did on the subject before, it seems like a better approach would be to just get stuff out of /proc rather than relying on a thing which may or may not be a symlink or a real file, and if it is file could have been manually edited with garbage. tbh I cba thinking about it further though.
 
@DaveRandom there is no better approach to have here. I, like the OP in the linked question, want to know why docker filesystems listed in df dont show up in mtab
because they should show up in mtab
 
o/
 
\o
 
3:39 PM
Ø
 
@salathe does it mean "morning" too?
 
I just need 2 more rep points and my total rep count will be ideal 6969. :P
 
in preg, 3v4l.org/J8nHk vs 3v4l.org/h3S5N, the difference is only in the 3rd line (the additional spaces). One works, other fails. //cc @JoeWatkins, @NikiC
2
 
Wes
it seems there is no such thing as sense of humor in iran
 
humor is haram bro
 
Wes
3:43 PM
lol, i hope it's not true
 
any ideas what could be causing this?
I am getting a feeling, that this might be some "buffer size" type of thing
 
@Wes of course its not. That'd be stupid
 
See @Wes! ^
:P
 
@tereško ew, why are you parsing HTML with regex?
 
3:46 PM
not me: a coworker has been banging his head against this for the entire day
 
Wes
@tereško guess: [\\s] should be [\\s]+ ?
 
@tereško cool story (:
 
@Wes relax, it is not :-)
 
Wes
that regex is insane tho
 
3:48 PM
@Wes one of those produces the expected result, the other - only in php 5
 
@tereško the failing one has PREG_JIT_STACKLIMIT_ERROR error, which isn't hugely suprising.
 
@JayIsTooCommon /me is installing ableton 10 \o/
 
@salathe hmm ...
but why ?
 
@tereško ini_set('pcre.jit', 0); // >:)
 
1 min ago, by tereško
@salathe hmm ...
 
3:50 PM
@tereško other than "you're reached the JIT stack limit"... I don't have an answer, sorry.
 
so, the whole thing will need to be migrated to Twig anyway
 
(related discussion: externals.io/message/87245)
 
:D
 
@tereško it takes the regex 16361 steps to parse that string.
 
:D x2
 
3:51 PM
rookie numbers
 
@PeeHaa I just tried doing this !!regex <[^>]
in the playground :P
 
Yeah it's an easter egg
 
Yeah, I got scared, cause it starts with "Russian hackers pwn your webapp". And I was like wtf? :P
 
:)
 
!!regex <[^>]
 
4:03 PM
@Allenph Pattern must be wrapped in a code block
 
did you see it?
 
Rofl. Yeah.
 
:P
 
Anyone know what this regex does? ¯\_(ツ)_/¯
 
which?
 
4:06 PM
Hello All
 
user9273838
Hi guys!
 
user9273838
Is Tony in here? Need his help on a regex
 
@mega6382 :)
 
@Fabor try it.
 
user9273838
@mega
 
user9273838
4:12 PM
@mega6382 will do:)
 
Man the wall people never cease to amaze me with their ridiculous claims.
 
@AndrewMinhSkettles Who are you? why are you pinging me? what do you mean?
 
user9273838
@mega6382 you dont remember me? I'm a huge fan!!!!
 
user9273838
@mega6382 you getting spicyyy
 
No, I don't think I know who you are.
 
user9273838
4:15 PM
@mega6382 shhhhh you do. Just remember to smile:)
 
Wes
watsup
 
@PeeHaa That's direct user input to unserialize, not user input somewhere in the serialization.
 
@tereško most likely you hit a backtrack or stack limit
 
Anonymous
5:07 PM
@PeeHaa wat that?
 
!!regex <('-'<)
 
nice
 
See, its quite cool.
@Fabor why, are you scared?
to try the real thing?
 
5:45 PM
I'm just kidding :P
 
:P
 

« first day (2749 days earlier)      last day (2203 days later) »