« first day (2658 days earlier)      last day (2308 days later) » 

10:00 PM
Will postgres automatically close a connection if there's an active prepared statement?
 
prepared statements are things that are designed to be used over and over, if it's single use then you want a parametrised query, which is a different thing
@Trowski I don't know, is the short answer
I'd imagine that timeouts are timeouts, it's just based on activity
 
Wes
english people, i need a list of one-words that i want to use as different error/message severity, like PROBLEM, DISASTER, NOTICE, WARNING, etc do you have some others?
 
I would not expect the existence of a prepared statement to be considered a blocker to connection timeouts from the server side
that would be a huge DoS vector, apart from anything else
 
@DaveRandom Neither would I, which presents a bit of a problem.
 
The thought occurs that possibly the OPs use case may be better suited to Connection#execute() anyway
I know that for a lot of PHP devs in particular, "prepared statement" and "parameterised query" are synonymous because MySQL
 
10:04 PM
Yeah, for the OP he should be using execute.
 
in reality in a long-running app, I don't think deallocation of prepared statements comes up that much, typically you either have a resuable thing that you keep around forever, and for unique snowflake queries you just want execute()
I don't know what his use-case is though, it may even just be that he's getting these exceptions during shutdown
in which case try/catch/forget is fine
 
Wes
lol
@DaveRandom do you know if core or ext constants (except true, false, null, magic constants) can ever be case-insensitive?
 
well they certainly can
whether any of them are I don't know
I suspect not
 
@Wes https://github.com/Allenph1/DDDPractice/blob/develop/src/Domain/Component/MySQLDataMapper.php

This part confused me a little bit. Those three things are only related by being repository dependencies...it didn't seem right to create an object to encapsulate them.
Plus if I did so, it seems like that would be hiding dependencies?
 
@Wes just looking at lxr.room11.org/…, it looks like the interbase ones that show up on page 1 are case insensitive (no CONST_CS flag)
 
Wes
10:19 PM
amazing. i wish i had the extension compiled :B
so if i do IBASE_bkp_IGNORE_CHECKSUMS it works?
 
moment, just installing it on my dev box to find out
[daverandom@dev-centos7 scripts]$ php -r 'echo IBASE_bkp_IGNORE_CHECKSUMS . "\n";'
1
yup
 
Wes
thanks dave
 
I can't see any others in php-src from a cursory glance
 
Wes
much appreciated, i'm adding them to the list \o/
@Allenph not sure what the question is
 
@Wes the key is CONST_CS. There will almost certainly be places where constants are defined without using that macro, especially in PECL. Compiling an exhaustive list will be basically impossible.
 
10:24 PM
@Wes Every single MySQL repo needs those 3 things. It is implied by the factory and datamapper interfaces. Without extending I either rewrite that bit more than once (not DRY) or I write a new object which contains all of those three things and dependency inject it. But, the latter doesn't seem to be a good case. It would be such a weird object I struggle to know what I would call it.
 
Wes
don't we have pecl on lxr?
function __construct(PDO $connection, String $table, Factory $factory) {
$this->connection = $connection;
$this->table = $table;
$this->factory = $factory;
}
 
it's not a single repo that you can reasonably source
 
Wes
you may need more tables (for sure...) and multiple factories
 
a lot of pecl extensions are just on github these days
 
Wes
so your "premature generalization" is wrong already
and that's why you don't create base classes
 
10:26 PM
XY... what are you actually trying to do?
 
is there a fast way to get all unique characters (store them in a hashset) from a huge array of strings?
 
Implicitly you have to visit every character, so not really
 
Wes
i'm writing a static analysis tool that detects inconsistent identifier casing in constant methods functions etc
 
or at least, nothing cleverer than just looping every char in every string
 
10:28 PM
I was hoping that there is some magical algorithm that does this :(
 
@Wes So it's okay to repeat yourself? o.O
I would repeat it 4 times.
 
Wes
DRY is very much misunderstood
!!google Don't repeat yourself misunderstood
 
Search for "DRY misunderstood -site:w3schools.com" (https://www.google.com/search?q=DRY+misunderstood+-site%3Aw3schools.com&lr=lang_en)
• Dry & Bitter Misunderstood - RateBeer - Dry & Bitter Misunderstood a India Style Lager beer by Dry & Bitter Brewing Company, a brewery in G… (https://www.ratebeer.com/beer/dry-bitter-misunderstood/362557/)
• Misunderstood - Dry & Bitter Brewing Company - Un… - 3 okt. 2015 - Misunderstood brewed by Dry & Bitter Brewing Company as an Lager - IPL (India Pale La… (https://untappd.com/b/dry-and-bitter-brewing-company-misunderstood/1260340)
 
Rofl.
 
@someone If I give you 3 bags of marbles, can you tell me what colour marbles are in the bags without opening them and looking?
 
10:29 PM
Search for "Don't repeat yourself misunderstood -site:w3schools.com" (https://www.google.com/search?q=Don%27t+repeat+yourself+misunderstood+-site%3Aw3schools.com&lr=lang_en)
• Orthogonality and the DRY Principle - Artima Deve… - 10 mrt. 2003 - Bill Venners: What's the DRY principle? Dave Thomas: Don't Repeat Yourself (or DRY)… (http://www.artima.com/intv/dry.html)
• Principles and mottos: misunderstood and applied… - DRY - Do not repeat yourself. This is a simple one, isn't it? Just don't duplicate code. Whenever y… (http://railshurts.com/principles/)
 
Wes
> Duplication is far cheaper than the wrong abstraction
this is a great quote
 
Hmm. All right. I'll remove those.
 
I think in one of Anthony's talks he said that if he copy/pastes something more than twice, then he'll put it into something (class, function, whatever)
 
Wes
it's just matter of how you couple different bits of code
extends is high coupling, and it's bad m'kay? :P
 
@DaveRandom No. Since I'm parsing a stream of data I guess I will do it while I'm building the array so I could save some time.
 
10:37 PM
Third argument of header() function has wrong description. – #75875
 
@Wes you could detect them (if they are defined where you are running) with 3v4l.org/cFEMZ
@someone what is the problem you are trying to solve?
this seems like a somewhat odd requirement
i.e. what are you going to do with that list of chars once you have it?
 
I use it to build a virtual keyboard from the characters that only exist in the data set because the data set is made from different languages so it does not only contain English characters. Building a keyboard for every language is painful so this would be simpler.
for example if the array is [Test, 测试] the keyboard will have the following keys T, E, S ,T , 测, 试.
 
@Wes I found a picture of you coding the other day.
 
there is no second T :)
 
Wes
did you find my nail cutter too?
i can't find it
 
10:50 PM
 
@DaveRandom Well after 15 minutes on inactivity a prepared statement was still executable.
 
@someone then yeh, you are going to have to loop the data, And you are going to have to be careful if you are iterating a stream of data that you don't chop multi-byte characters that cross read boundaries
 
Actual picture of Wes coding. Circa 1941 (Colorized)
 
That can't be right, wes uses an old 386 with edit.com in DOS
 
Wes
GIMME MY NAILCUTTER
WHO STOLE IT
 
10:51 PM
nail clipper*
 
Wes
whatever
 
Use your teeth. The ladies find it attractive.
 
@Trowski I have been assuming there's some kind of server-side timeout, a quick google did not turn up a setting for it though
I mean, there must be one otherwise the server would hit ulimit all the time, that can't be a thing
 
@DaveRandom Maybe authenticated clients just don't timeout… I dunno. I'm not really happy with that answer though. I know timeouts are a thing in MySQL, so I'm compelled to write a PooledStatement class that I can use in both libs.
 
tcp_keepalives_idle, tcp_keepalives_interval and tcp_keepalives_count will be the answer postgresql.org/docs/current/static/…
it will be tcp_keepalives_idle + (tcp_keepalives_interval * tcp_keepalives_count) seconds
(I assume)
 
Wes
11:01 PM
fucking piece of shit.
 
@Wes what the fuck
 
lol epic
 
Wes
that's not even the worst thing i'm finding
 
some code somewhere in wordpress at some point relied on "bareword strings" or whatever the madey-up term for just referencing symbols that don't exist because yolo was
The // Back compat. comment is the best bit
 
ah, wordpress
 
Wes
11:08 PM
$primitiveTypes = ["bool", "int", "float", "array", "string", "iterable", "callable", "object"];
are there others?
 
assuming you are not counting void, no
 
Wes
ah damnit right
 
that needs special handling though
 
Wes
yeah
 
Does this serve any purpose? (BC maybe?) Also, call it twice to be sure?
 
Wes
11:14 PM
lol
i can relate. that class is so bad they want to destruct it many times
 
Wow… the class properties list ends on about the line where I usually start thinking my class definition length may be indicating that the class is doing too much.
 
@pmmaga The register_shutdown_function() I have no idea, maybe there is/was some case where dtors would not be invoked on shutdown. The no-op method will be there so that there's always a thing to invoke that can be overridden. The return true is just... weird.
I mean the whole thing is weird but that reads like a commentless hack for some very specific ancient edge-case problem
speaking of commentless... I have no idea how my DNS compression routines work :-/
 
Wes
to be fair if child classes called
parent::__destruct from its override, maybe they need the return value for doing something
not sure what but could be
if(parent::__destruct()){ ... }else{ }
 
Gentlemen... this way, madness lies
 
wtf goes in the else block?
 
11:20 PM
pray_to_elder_gods()
 
"If you couldn't destroy this object, do something else with this object that is being destroyed"
 
it's WP so that's definitely not an instance method
 
Wes
return true doesn't necessarily mean destruct was successful
i'm not referring to the specific case, i'm saying that __destruct could be designed to return information useful to inheritors... i'm not sure how though
 
if (!parent::__destruct()) {
    exec('nohup cat /dev/urandom | /dev/audio > /dev/null 2>&1 &');
}
 
sacrifice_to_void_demons($this);
 
Wes
11:33 PM
how bad is this:
public function bar($a, $b, $c){
    $this->a = $a; $this->b = $b; $this->c = $c;
    $this->callPrivateMethod();
    $this->callPrivateMethod();
    $this->callPrivateMethod();
    $this->a = NULL; $this->b = NULL; $this->c = NULL;
}
versus:
public function bar($a, $b, $c){
    $this->callPrivateMethod($a, $b, $c);
    $this->callPrivateMethod($a, $b, $c);
    $this->callPrivateMethod($a, $b, $c);
}
 
just use args
but what's the real-world use case?
 
Wes
what if the class consists in just a function (bar)
 
46 secs ago, by DaveRandom
but what's the real-world use case?
that code looks quite unrealistic
 
Wes
the real world use case is that $a $b $c are long variable names and i'd rather not pass them all like that
 
maybe shorten the names?
 
Wes
11:36 PM
okay. :P
i mean, is it really that bad, considering that the class is just a function? :B
 
why would you have a public method that just calls the same thing 3 times with the same data?
 
public function bar($a, $b, $c){
    $args = [$a, $b, $c];
    $this->callPrivateMethod(...$args);
    $this->callPrivateMethod(...$args);
    $this->callPrivateMethod(...$args);
}
 
anyway, you already have that long arg list for bar()
 
Wes
arguments don't always match so can't do that
that's why i wanted to use class fields as storage
it's not a big difference, everything is private anyway
 
@Wes that's uggo
 
11:37 PM
^
 
Wes
i know :P
 
once you type it, does it matter anymore if the names are long?
 
Wes
it does because i'm changing them all the time :D
 
(alt click) -> refactor
 
Wes
fine
 

« first day (2658 days earlier)      last day (2308 days later) »