« first day (2244 days earlier)      last day (2704 days later) » 

10:00 PM
@bwoebi Right, and doing something like this:
 
but [0 => 3] === [3], always
 
$arr1 = [0, 1, 2]
$arr2 = [0 => 3];

$arr3 = [...$arr1, ...$arr2];
 
ThW
@MadaraUchiha you can even overwrite elements eval.in/private/e77549e804cee9
 
But what does [sqrt(-1)] === ?
 
A distinction has to be made
@Sara $up = new Exception(); throw $up;
 
10:01 PM
:D
 
@MadaraUchiha $arr2 === [3] === [0 => 3] … the information about whether the key was explicit is NOT retained.
 
@bwoebi Then, for this feature to work, it would have to be.
 
@MadaraUchiha should be NAN though
@MadaraUchiha good luck when you mutate that array somehow later
 
throw new ┻━┻;
7
 
@bwoebi The string 'NaN' (at least in JS)
 
ThW
10:02 PM
@MadaraUchiha You should not throw Exception, define your own class/interface
:->
 
What about [1 => 3] @bwoebi?
 
@MadaraUchiha how does that differ?
 
is it === [3] as well?
 
[3] is just syntax sugar for [0 => 3]
 
No
 
10:02 PM
Does PHP have the concept of a sparse array?
 
@MadaraUchiha no (at least not to userland)
 
However: $a = [2,3]; unset($a[0]); $a === [1 => 3]
 
Good, because JS has and it's a huge wart.
 
Depends what you mean by a "sparse array"...
 
@Sara This is a thing in JS:
 
10:03 PM
@Sara implicit undefined initialization
 
PHP's "MixedArray" implementation is sparse....
 
const arr = Array(50);
arr[35] = "hello";
 
Probably not the same use of "sparse" then
 
@Sara right
 
If you console log that, you get something like
 
10:04 PM
Nah, you don't pre-allocate arrays in PHP.
 
[undefined x 35, "hello", undefined x 14]
 
Most you'd do is: $arr = array_fill(0, 50, 0); $arr[35] = 'hello';
Or I guess, array_fill(0, 50, null); if it's undefined rather than zero
Not that null and undefined are strictly equivalent
 
ThW
if you really need the keys
 
@MadaraUchiha given that this doesn't work that way, how should the feature work?
 
@bwoebi I'm guessing it wouldn't :P
 
10:06 PM
@MadaraUchiha Now you got @Wes issue…
 
I see
 
ThW
:-)
 
Yeah, I'm not seeing an easy way around it either.
Shame, it's a useful feature.
 
@MadaraUchiha It would… at least it'd be sugar for array_merge()
 
ThW
urgs
 
10:10 PM
@bwoebi Right
How does array_merge() handle the [0=>3] case?
Just appends?
 
@MadaraUchiha appends numeric keys, overwrites string keys
 
ThW
reallocates keys if they are numeric
 
@bwoebi Hmm, then I guess that this spread could be exactly the same...
 
perhaps
 
I mean, JS's array spread is sugar for [].concat() and object spread is sugar for Object.assign()
 
10:12 PM
I want to add 2000+ rows to a DB at once, is this a good idea with PHP/PDO?
Or, what should I limit it to?
 
@Alesana 2000 rows isn't a lot, sure.
Use a non-emulated prepared statement, and just execute it with different values.
 
Execute it repeatedly 2000 times?
 
Oh btw @tereško I went back and checked on my claim about the 50 queries vs prepared statement
It's not that a prepared statement is as expensive as 50 queries
 
ThW
for really fast inserts you might need to use something dbms specific
most dbms have some support for mass inserts
 
but the overhead of a prepared statement only starts being worth it if you have a batch of 50 queries or more
 
10:14 PM
I am using MySQL
 
ThW
and of course you could generate a file (sql) and use the console tools
 
i.e. 40 queries is less expensive than 40 executions of the same prepared statement
(approximately)
@Alesana Is that a one time thing? Or is it regular?
 
Regular
 
15 minutes till quitin' time!
 
ThW
mysql has a really simple mass insert syntax, just add additional value blocks
 
10:15 PM
"time to disassemble this assembly line!"
 
@ThW Right, but then you need to beware of SQL injections
 
ThW
but generating an sql file and using the console tools might still be faster
 
Where does the data come from @Alesana?
 
ThW
@MadaraUchiha of course
 
Well, ideally, I want it to check ~2000 rows to see if the row already exists, if it does, see if it's different, if it's different update it, if it doesn't exist add it. It comes from JSON which gets turned into an array
 
10:17 PM
@Alesana And where does the JSON come from?
Or rather, where do the values in the JSON come from?
 
ThW
2k is not that much
 
From an API link, or from a file uploaded, either or
 
ThW
still fits into RAM
 
@Alesana a.k.a. user input
 
Right.. The format of each API's JSON will be different but I already have code to get make an array from each JSON with the values that I want to be inputted.
 
10:18 PM
@ThW 2 billion would probably still fit into RAM too, depending on the info
 
For the uploading JSON it will be simpler as it will be required to be in a certain format.
 
That's not my concern
 
ThW
@MadaraUchiha yeah, but for 2k I would not start thinking about serial read
 
If it comes from user input, you need to worry about SQL injections
Which means that just generating a large insert query with all the values is out.
 
I am making a script where the user upload it to his server,
 
10:20 PM
@ThW True.
 
and only he
will input data. Sorry, cat keeps hitting the enter button
 
ThW
not really, mysqli has a method for that (that takes the encoding of the connection into account)
 
@Alesana No, you are making a script where the user uploads it to their server, and then they do whatever they want with it.
You don't get to control who your users' consumers are.
And you don't want to expose your users' to attackers
 
mm.. what's the basic order a directoryIterator uses?
 
Not to mention, All the O'Connors in the world would hate you.
 
ThW
10:22 PM
@Naruto none
 
True
 
so it's basically in a random order?
 
Well, the user could also allow other's to access his database directly
 
So in my opinion: Just prepare an insert on duplicate key update query
Iterate the array, then execute the insertion query for each entry.
 
ThW
@Naruto not really, it depends on the file system
 
10:23 PM
2000 isn't a lot.
@Alesana Right, but granting database access and granting web UI access are two very different scenarios
 
Okay, well I put an estimate for 2000. Any suggestions for a max to put on it?
 
@ThW mm okej, I learned something new today :)
 
@Alesana 50k should be no problem too
 
ThW
@Naruto it is the read order, depending on how it was stored, nothing reliable but not random
 
Make sure to turn off emulated prepares
 
10:24 PM
Any idea on the speed it would take to do 10,000 on regular shared hosting?
 
@Alesana Nope. Test it.
 
ThW
@Naruto actually a true random order is difficult to get
 
Will do
 
Should be easy enough setting a test script.
@ThW /s/difficult/impossible/
 
@ThW well I don't need anything random, since I'm ordering them afterwards anyway, but I was just wondering about the 'default'
 
ThW
10:26 PM
s/true random/enough randomized
:-)
 
Well then, it depends on your definition of enough :D
 
ThW
@Naruto yes, for this the answer is none, not even random
 
'undefined order' is the term you're looking for.
 
that just feels.. strange :P
 
@Naruto You've clearly haven't programmed enough in Java.
 
ThW
10:29 PM
well if you get an basket of apples, do you care about the order?
 
@ThW To be fair, if the apples are named...
 
@MadaraUchiha nope, it's been a long time since I've been in that hellhole :D
 
@Naruto Recall how Java's HashSet and HashMap have no defined order.
 
@ThW then I would still think the order of them being put in the basket...
 
This is the same.
 
ThW
10:31 PM
@Naruto why?
 
because logically, the last one you put in theb asket most likely is the first one you are going to take out of the basket? unless you have a really big basket
 
@Naruto That wasn't the question.
The question is whether you care about the order or not.
The answer to that one is usually "no".
 
ThW
the apple pie will still taste the same
 
well... no :P
 
@ThW Although, the same can't exactly be said about filesystem iterators
I can see a scenario in which I'd want to apply binary search on a bunch of directories or something like that
 
ThW
10:34 PM
yes, that is why you want a specific order (natcasecmp mostly)
 
But then again, performance is probably more important for a filesystem iterator.
 
ThW
get, filter, get, filter, sort, output
 
@ThW Oh, you can specify an order then?
 
ThW
nesting iterators
 
Dear room. Today at job I had a one hour massage from a great massage therapist. This life is awesome. #TrueProgrammingJobsPayYouMassages
 
10:37 PM
@Tiffany ^ might want to start working there? ^^
 
@DaveRandom I could use your opinion
 
Wes
"massage therapist" with or without air quotes? @FélixGagnon-Grenier youtube.com/watch?v=o8RT9Dzb7og
 
the real question he wants to know is: was there a happy ending or not?
 
@Wes funny, I assumed @PeeHaa would actually be the one doing these jokes
 
ThW
get your mind out of the gutter :-)
 
Anonymous
10:38 PM
@FélixGagnon-Grenier .. We have dyson hand dryers ?
 
@JayIsTooCommon awesome!
 
@FélixGagnon-Grenier I was just thinking about how much I hate massages :P
 
@Wes @Naruto nothing like that, a true legit massage in the actual building
 
If I were @Gordon I would say: they rub me the wrong way
 
I mean seriously, things are totally less stressful now.
@PeeHaa Hopefully you will find your... "right" way someday :)
 
10:40 PM
I just get bored after 5 minutes
 
Anonymous
@PeeHaa You need to get a massage from a real man, then you'll enjoy it
 
@PeeHaa Do you have what they call, "autism"? (sorry for the actual autists in this room, no insult meant)
 
@JayIsTooCommon Been there done that :P Was a huge hairy turkish guy. Still no dice :)
 
Wes
twitter.com/WesNetmo/status/806628228404232192 how do i debug this? shouldn't it timeout or something
 
Anonymous
lol
 
10:42 PM
@FélixGagnon-Grenier I'm just special :P
 
ThW
@FélixGagnon-Grenier not the only reason
 
@Wes the cli doesn't timeout by default
 
ThW
@PeeHaa but i think you can still set it
 
Yes
 
ThW
10:44 PM
so that might be a first step
 
@Wes run it with phpdbg, press ctrl+c when it hangs, then t to see backtracte
 
Good guy phpdbg
 
:-D
my favorite php debugging tool, right after var_dump().
 
Wes
@bwoebi well trolled bob, well trolled
 
@Wes what version are you using?
 
ThW
10:47 PM
I still use the FirePHP extension
 
@Wes and get me a backtrace
 
alright, gn everyone and thx @ThW
 
Wes
php master
of few days ago
 
@Naruto o/
 
Wes
@bwoebi dunno how to do that
 
10:48 PM
!!uptime
 
ThW
@Naruto g8
 
@PeeHaa I have been running for 1 day, 3 hours and 13 minutes, since 2016-12-06 19:35:09
 
@Wes bugs.php.net/bugs-generating-backtrace-win32.php (just use phpdbg.exe instead of php.exe)
 
Wes
@bwoebi that's what i do
 
@Wes ?
 
10:50 PM
I was listing things to my girlfriend the other day and I was listing them, in my head, I was putting them into a PHP array
 
Wes
phpdbg.exe -qrr "./phpunit.phar" -c etc etc
 
I need to take a break haha
 
@Wes well, that should work fine… hence I ask for a backtrace
 
ThW
@Alesana Happens, I dreamed in SQL (several years ago), got a new Job
 
Inventive but not very useful. Could it be tweaked to show day, hours and minutes instead? — Lightness Races in Orbit Dec 6 '15 at 18:28
I love these guys
 
Wes
10:52 PM
 
:-D
@Wes batch job?!
 
Wes
i have no idea...
 
ehm @Wes are you executing the windows phpunit batch file?
 
Wes
yes. so that's not related?
 
@Wes no.
 
10:54 PM
@PeeHaa on mob so difficult
 
@bwoebi Isn't that just te default kill message in cmd?
 
@PeeHaa if you run a bat, yes.
 
@DaveRandom Nevermind. I'm just going to do it quick and dirty and let you fix it later :P
 
Well... good?
 
You're welcome
 
Wes
10:56 PM
wtf....
 
Ty
Ugh fuck this mobile chat thing
 
@Wes ?
 
Wes
/** @dataProvider getSetTests */
function testSet(........){
    return; <- crashes regardless
 
@Wes just get me the damn backtrace
 
Wes
bob, that's not possible. if i hit ctrl+c phpdbg crashes
 
10:58 PM
ain't that the point?
 
@Wes I mean the C backtrace of the phpdbg process…
 
Wes
and i would rather pet peehaa's ass than do this bugs.php.net/bugs-generating-backtrace-win32.php
 
The joys of Windows
 
@Wes okay, pet PeeHaa's ass now, but do that nevertheless.
 
Wes
:B
 
10:59 PM
@Wes don't tell me you still haven't set up a VM?
 
no seriously, please.
 
Not sure how my ass just got involved but I am not complaining
 
@PeeHaa Move it to @Wes, he wants to pet it.
 
Wes
@NikiC that doesn't matter as i'm forced to use windows regardless
 
@Wes who forces you?
 
ThW
11:00 PM
users :-)
 
Wes
@NikiC server is windows and it's not mine, so it has to run on windows
 
user895378
@LeviMorrison I do, but I'd rather not discuss publicly. We can gchat sometime
 
Anonymous
ugh i'm being a noob
 
user895378
@PeeHaa Me neither.
 
11:03 PM
:P
 
user895378
windows :(
 
Wes
the thing also has other stuff like another software, mssql server, etc
 
@Wes please, do this.
 
Wes
@PeeHaa come here
:B
 
what
 
11:06 PM
@Wes oh god, a windows server
don't tell me you're also using mssql
 
4 mins ago, by Wes
the thing also has other stuff like another software, mssql server, etc
 
Wes
yes. keep reading. but i don't use it, there are other software that use it that run on the same server and that i don't understand
the thing is not publicly available on the internet though. that's the good part :B and it works, somehow..
i think i need to recompile php with debug pack
 
@Wes well, that's easiest
 
@Naruto Haha, that sounds amazing. But I'd have to learn French. From what I've heard from a couple first-person POV is that Quebec can be rather mean to anglophones if they can't speak French.
 
Why must all LALR generators be language bound
Could just dump raw tables and be portable :/
 
11:12 PM
@NikiC I have an idea… parse the resulting c file!
 
ThW
...
 
Wes
@bwoebi on windows? :B
 
@Wes not sure
 
Wes
Y U DIEEEE
gosh..
 
Wes
11:29 PM
When PHP crashes, "click Cancel to debug the process"
there's no cancel :|
means i should follow "without compiler" part, right?
 
@Wes dunno…
 
You know you've been in this room too long when you start referring to it at work for work-related issues.
Or perhaps, not long enough.
anyway, I'm going homee \o
 
Wes
i quit programming
and possibly life
 
11:48 PM
@NikiC It's annoying. Want to use an existing tool and then use it in Rust? Possible, but no fun.
 
@LeviMorrison There's really no good reason why this should be...
The parsing code itself doesn't even really benefit from being generated
The only important parts are the tables and to some degree the semantic action bodies
 

« first day (2244 days earlier)      last day (2704 days later) »