« first day (2481 days earlier)      last day (2692 days later) » 

Anonymous
12:00
As long as we can kiss afterwards
:P
@tereško ah cool, thanks. Can you point me to a repo I could browse the source code? I've looked through a couple on github, but some are years old and it's hard to tell if its still 'acceptable'
@Daruchini I dont have any repos to point you to
@tereško point to the easy work
bob
bob
12:03
hey people, I got a strange issue. I'm updating a row in mysql, with radios and i put the following code in the processing page. pastebin.com/1fNAD3v0
what?
Anonymous
/me points to @PeeHaa's mum
..... aaand you have been added to ignore list
me? </3
Anonymous
> receive_emai
12:05
guess so
Notes mailer not sending mail – #75016
3 messages moved to Trash
@bob what's the issue?
What is your field type in db: int, varchar ?
You're using on|off strings if you wanna set them into db probably you should cast them to int or boolean
12:24
lol
Is this the correct way to close an array of PDO connections? or is the foreach doing some strange pass by idk, and leaving the connection open?
 public static function pdo_shutdown(array $connections) {
            foreach($connections as $conn){
                $conn = null;
            }
        }
@WesStark every interview i've ever had
if you avoided static methods, garbage collection would shutdown pdo for you
@WesStark that's totally how I do it once a year
also, are you sure that you need multiple pdo connections?
12:27
I should write a blog post on "why database connection pooling (probably) doesn't make sense for you in PHP"
@WesStark I'm not 100% sure I need multiple pdo connections, but I'm making a wrapper that I can include once in all of my various apps. like laravel.com/docs/5.4/database
@DaveRandom good thing I'm not connection pooling
@bassxzero No
*rolleyes*
@PeeHaa No as in the code has a bug or no as in don't do it?
12:28
@DaveRandom yes do it.
@bassxzero You are working on a copy
And no, bad idea in general :P
@Gordon you put the effort in to not italicize that 👏
@PaulCrovella I leave the italization to @WesStark and @Ocramius
@bassxzero Multiple connections are useful in precisely 2 scenarios: 1) connection pooling (only really practical in long-lived applications i.e. not web PHP) 2) you need to talk to more than one database (you need 2 instances of your wrapper, because you need to know which connection you are using)
If you are doing neither of those things, you don't need multiple connections
@MadaraUchiha I bet five dollars that this person has a sock-puppet upvoting their answers: stackoverflow.com/a/45433972/778719
12:30
It's a bad idea for several reasons a.o. but not limited to: another db wrapper, connection pooling, closing connections which get killed automagically
If you are doing 1) you are going to have to do all kinds of horrifying magic and PDO is probably not for you
The answer is completely non-sensical, but has an upvote. As does apparently most of that users answers.
if you are doing 2) then as stated, you would need 2 instances of whatever wrapper, so you don't need multiple connections internally
@Danack totally. you better look at this Danack guy and ban him
tl;dr you don't need multiple PDO connections in a database abstraction
12:31
@WesStark alternative to multiple apps, on the same server, connecting to the same host, possibly different databases, without duplicating connection information N times?
@Gordon it flashes the linked answer, scrub. My answer is a source of wonderful enlightenment.
behold the wonder of variables
Anonymous
@Gordon lol
@bassxzero If you are connecting to different databases (even on the same server), that should be be treated as a totally separate connection always, because the auth details should always be different
Database Wrapper was the wrong word choice. More accurately stated Database Connection Credentials Manager.
Why would you need the same set of credentials more than once? (ignoring graceful reconnect logic, which is probably not applicable)
12:36
Different apps on the same box connect to a shared database in some cases. Didn't write it, I just maintain it... until I have have to rewrite it. But for now each time any server changes happen, I have to grep for the connection info and go change it in N places.
@Danack a flag never hurts
Well actually.......
@PeeHaa flagged :P
12:38
Hello
@DaveRandom You think it is possible to use set windows VPN to work through Chrome profile? So Profile 1 uses normal connection, profile 2 uses VPN.
Need Help
@Hetal1311 call 911
Hello, I am Galstaff, sorcerer of LIGHT!
We do not write code to match your requirement However we are more than willing to help you fix code that you have tried to write and cannot get working as you would like — RiggsFolly 2 mins ago
Please have a look on this link nd help me out
Rather than giving minus point please help
@Hetal1311 I am agree with that comment
@Hetal1311 number_format, round, IntlNumberFormatter. These are your google terms.
Only Beatles song I really liked was Walrus, thanks to Jim Carrey
No Solution :(
12:41
@Fabor goo goo goo joob
heh
@Danack all answers by stackoverflow.com/users/6884282 are also copies/rewrites of older answers on old questions; and all upvoted to +1
But I never flagged a single chat comment @WesStark!! Also, how do you know you've been flagged?
BTC just hard forked. Should be interesting to see what happens
12:47
@Fabor yup; waiting for the first block
@FélixGagnon-Grenier i've been challenged to a trial by combat by a moderator
chaos in the tulip bulb markets
i was joking tho :B
@WesStark who's your champion?
    abstract class DB {

        public static function connection($connection_name) {
            $connection_name = strtoupper($connection_name);

            static $connections = [];

            if ( !isset($connections[$connection_name]) ) {

                $pdo_info = [
                    "conn1" => [
                        'host' => 'host1',
                        'database' => 'database1',
                        'user' => 'user1',
                        'pass' => 'pass1'
                    ],
12:51
user image
3
lol
@WesStark Have you seen the new Mickey Mouse shorts they're making? They sometimes cross into Ren and Stimpy territory
@WesStark out with it man. What's wrong with it given my constraints?
sorry @bassxzero :P don't use static, especially function scope static. those they can't even be overridden
@bassxzero is there any particular reason, why you are splitting up the DSN?
and, why the fuck are you emulating the prepares?
12:54
@WesStark I just refactored a script the other day, that created a connection each time it ran a function. Over 12k times. I used a static function as a provider and the script went from 20+ mins to ~1 min and 30 seconds. What's wrong with static?
then your code has deeper issues
@bassxzero you could also create a single object holding the connection instead of re-creating it every time.
if I had to bet, I would put my money on you not knowing how to use dependency injection, @bassxzero
@tereško splitting the DSN vs string expansion? I believe I read that emulate prepares is just as safe as non emulated and it allows me to use the same placeholder multiple times.
you were lied to
12:58
@FlorianMargaine a class instance holding the connection? like a singleton or something that the script would have to ensure doesn't get instantiated more than once?
@bassxzero not everyone likes exit calls in their database library
@bassxzero not a singleton, just a normal object that you only instantiate once.
$db = new DB();
for ($foo in $bar) {
    run_function($db, $foo);
}
basically ^
12:59
@Sjon agreed, but in this use case It's good. If you want me to explain I will, but I have considered it.
@bassxzero read how do employ dependency injection
@bassxzero why not use an exception, like the other error case?
@FélixGagnon-Grenier connection string not defined would only happen in the case where I mistyped. End users will never see it. It's more of a bug catch.
@tereško @FlorianMargaine Again I'm just maintaining code until I have the free time to fix it. Example of what I have to maintain. pastebin.com/q3pievyj
@bassxzero I have no idea how what you just said is related to using a exit.. in any event, that class should not be responsible with managing credentials. It would be better accepting credentials and returning a connection object.
@tereško do you have something I can read about emulated prepares? This is the type of stuff I have been referencing. stackoverflow.com/questions/10113562/…
see #2 on the top answer.
13:07
8 mins ago, by PeeHaa
@bassxzero cough cough
@bassxzero did you actually pay attention, or were you just looking for validation of what you had already decided to do
all of the answer, mention that emulation should be used only on legacy php and mysql systems
that's pre5.5 php and pre5.1 mysql
@bassxzero the point is that it does both jobs at once. Moreover, would you really be doing a commit each time a connection info would change?
@tereško php 5.3 mysql 5.1.49
13:10
Connection info should reside in configuration files, to be read at run time by classes that need it
@FélixGagnon-Grenier *to be passed to
it seems we are just banging out heads against a wall
@Machavity well aware. Forced constraints. Guys, this is not something I WANT to do.
13:14
@PeeHaa thank you. This is useful and applicable to my case.
Both links I shared are
@FélixGagnon-Grenier much harder than a simple commit. The apps/pages are in a CMS with no search functionality. Each page published to two different servers, that I have 0 ssh access too. So no greps or etc. If connection info changes, I have to know where to find it each one. To top it off changes get sent to a queue and live in it for a min of 4 minutes.
If connection info changes, then why the hell have you hardcoded it inside your class?
Nullable Method Calling – #75017
@PeeHaa not sure blog.ircmaxell.com/2014/10/a-lesson-in-security.html applies to my case. I'm only preparing single queries. No dynamic query generation that I know of.
13:20
> A Lesson In Security
If you think you are smart and don't need to disable it you are doing it wrong and it just may blow up in your face
ehh ... my time will be better spent on actually writing some code
That's what I got from it
I may have paraphrased a bit here
For all of the PDO snobbery out there, MySQLi doesn't do emulation at all, which makes it more secure
Also the API sucks to the point you want to stab your own eyes :P
13:25
@Machavity it also doesnt do SQLite (which is really nice for integration tests)
I'm not saying it's all better, it's just the one point the PDO snobs have to concede
No
The only reason ever to use mysqli is if you need specific features
Scratch that. Two reasons
The second reason is being into bdsm
@bassxzero I hope they pay you well.
@Machavity no. What I would have to concede would be a lack of async calls. But you don't seem to be bringing it up
@PeeHaa I thought you had to cross that bridge to get into PHP in the first place
13:28
@PeeHaa something something lol something something Drupal something
@Machavity No argument there
@FélixGagnon-Grenier They actually pay me less than average. Don't plan to do it for too much longer.
@Fabor come again?
@DaveRandom We use a VPN to access our servers. There's a cert I had to import and then on windows I go to the VPN settings and enable it. Thing is, I want my chrome work profile to use the VPN but my normal chrome profile to not. Is it possible?
Isn't it just a case of routing specific addresses towards the VPN? Like, you only need to browse internal stuff over the VPN via your work profile, surely?
like you only need ip addresses that start with e.g. 10.10.50.x to go via the VPN
13:39
Yes, how would I setup a route like that though? More a windows question I guess.
Well when you connect a VPN windows changes the default route to that VPN. There are ways in the GUI you can tell it not to but it's generally unreliable, however I have a slightly-hacky-but-works approach, moment
In respect to making modular programs, should a single User class be responsible for creating new databases to my storage as well as checking user permission level or should it be split into seperate classes? e.g. gist.github.com/samtozer96/f34dc9d9180d74c0b598e19c19fe5d53
route -p add 0.0.0.0 mask 128.0.0.0 <your router IP>
route -p add 128.0.0.0 mask 128.0.0.0 <your router IP>
@Fabor ^
Good morning everyone
basically that adds 2 persistent routes that split the internet in half, so there's always a more specific route than windows' default route
13:42
Morning for me always comes at a different time lol
@DaveRandom not necessarily, using openvpn the server pushes routes which determine what gets routed over the vpn
The major gotcha with this is that if you change your router IP or go to another network with a different gateway, your network won't work until you delete those routes
@Sjon Yes but unfortunately almost nobody who runs a company VPN even knows what RIP is, let alone how to implement it :-(
@DaveRandom So how do I configure it for the addresses I use? (AWS ones really)
You can do all kinds of clever things with spanning tree over VPNs as well, very few people know how, or even know why they would want to
@Fabor what do you mean, sorry?
@DaveRandom well. I do; I don't want users to route their torrents through my vpn :P
13:46
Just trying to understand what is happening with those two route commands. Basically it will forgo the VPN?
So when you connect the VPN, windows will create 2 routes
the first is for the remote LAN subnet e.g. 10.10.50.0/24
the second is a "default" route i.e. 0.0.0.0/0
That approach ^ is a hack that basically makes windows ignore the default route by creating 2 more specific routes, namely 0.0.0.0/1 and 128.0.0.0/1, which are forced towards your local gateway
i.e. unless the destination address resides directly on the VPN subnet, send it via your router
however this can bite you in a number of subtle ways
The main reason that windows does this with the default route is to enable remote routed subnets to work without any additional config. When you remove that, you need to explicitly configure those subnets to run over the VPN
How is the destination address residence known?
Lets say my routing table looks like this:
Network Destination        Netmask          Gateway       Interface
          0.0.0.0          0.0.0.0      10.10.8.254      10.10.8.151
        10.10.8.0    255.255.254.0         On-link       10.10.8.151
0.0.0.0 is the default route, i.e. any address that doesn't match another route, send it here
"On-link" means that it's the local subnet, i.e. it doesn't need to be routed and can be dispatched directly
(there's another thing called "metric" which I will ignore for now because that's adding unnecessary for this discussion)
Now when I connect a VPN, something like this will happen:
@Fabor it might be easier to configure a proxy in your work-profile; if you have one. ssh has a default socks proxy you can use as well. No need for routes
Network Destination        Netmask          Gateway       Interface
          0.0.0.0          0.0.0.0    192.168.4.254      10.10.8.151
        10.10.8.0    255.255.254.0         On-link       10.10.8.151
      192.168.4.0    255.255.255.0         On-link       192.168.4.101
@Sjon * and disable the option that makes windows set the VPN as the default route
13:57
nods
@DaveRandom check
Personally I like LAN-to-LAN VPNs configured at the router with static routes, it's more maintainable for me, but then I am network-y kind of guy
@Fabor re: vietnam airlines, asking for a friend, "what was the flight like? TV? Phone charging? Space? Food? etc"
Well the vpn settings were imported/installed from a cert. Unsure how to set anything up for this, previous proxy experience has always just been user/pass.
@Fabor You'd need a proxy server running inside the remote network, there's a decent chance there is one though, windows server OSes come with one out of the box, it just needs to be enabled
13:58
@Leigh It's a cheap airline but not the cheapest. My flight has been only short but it was okay.
I have a 19 hour flight with them
and I'm a princess
I also have a 29 hour return flight
so I just want to know if it'll be a nice flight
Sounds like it's too late anyway.
Does sound that way :p
She can look up the plane type and read reviews about comfort etc.
@DaveRandom Sounds a little complex for right now, maybe I will try when not on work hours.
@Fabor I don't mind getting on a TeamViewer and seeing what you have to work with
Anonymous
14:01
flirt, flirt, flirt
/blushes
@DaveRandom heh that'd be good thanks, better to do it tomorrow though to minimize repercussions of Mr. Cockup.
@Fabor sure
This new PC loves to shock me.
TBF I should disconnect the PSU before fiddling.
14:07
you already assembled it?
btw, static charge can fuck up the parts
Anonymous
@Fabor no you shouldn't :P
Anonymous
ground yourself, keep it plugged in
there is a switch on the back of your PSU - you should be using that to turn it off
@PeeHaa Did you get a chance to look at the changes I made?
@tereško Yeah assembled and running. Skyrim mods added today
14:15
any issues?
@JayIsTooCommon pass :P VN electricity is no joke :p
Morning.
@tereško aside from them leaving a label underneath one of the plugged in memory stick, nope. Not hardware wise anyway.
Anonymous
@Fabor yeah I used to refuse to as well
the power cord actually assists in grounding the system
14:17
@Fabor like I said, ssh has one in the box. Easy as connecting to remote host: ssh host -D 8080 and you have socks proxy running on localhost:8080
Anonymous
@tereško this @Fabor, it is safe. Just goes against every instinct
Whats the best way to create db connections for a web app? Should I define credentials in config.php, create a class which connects and then require it on each file that needs it?
Feelsgood to multi task without stutters :)
Anonymous
!!framework
Anonymous
huh, thought that was a thing
14:20
> framework /ˈfrāmˌwərk/, n.: a product with the business logic removed, but all of the assumptions left in
Data corruption when reading fields of bit type – #75018
there is !!yii
ah, so somebody else has this deep burning hatred for Yii
@Trowski Nope sorry not yet :(
Anonymous
doesn't matter, I thought Patricks tutorial had db connection in it
14:25
@JayIsTooCommon would this do? stackoverflow.com/a/11369679/727208
@PeeHaa I have a bit of naming problem. I'd like to have an interface that is the combination of Connection and Handle, though I'm thinking that interface should be called Connection. I'm open to renaming all the interfaces. An interface that most methods would declare that is shared between transactions, pools, and connections should be maintained, which is currently Executor.
@JayIsTooCommon I think I managed to tell him twice, that he should learn what dependency injection is, before putting him in the tiny avatar list
might not be worth your effort
Anonymous
@Daruchini ^
Anonymous
14:29
@Daruchini github.com/PatrickLouys/no-framework-tutorial bits of this may help you. I'd handle credentials in your front controller and instantiate/define (through your DI) the classes with the required params there. But depends on requirements.
@PeeHaa don't be "that guy" plz
:-\
@JayIsTooCommon ah right ok, thanks :). So make it in the DI and then I can just share the instance around? I only ask these questions because more often than not, when I try to Google 'the correct way' to do something, I get even more variations than I first thought
@Ocramius I very much am
been there done that.
I have the git issues to prove it
Thinking about picking up my first ever bluetooth wireless earphones. Partially because my roommates cat has chewed through 3 of my earphone wires so far. Looking at Tesson t890
he does have issues, it's true
14:33
Otherwise we just cannot have any reasonable expectation of things not breaking in minors
@PeeHaa GIT has nothing to do with the sat solver...
@Ocramius The linked discussion does
You are breaking working code in a minor
Anyway, minor version dependency bumps are perfectly OK, otherwise any dependency change would count as a BC break. You should lock the PHP version you rely on in your project exactly like we did
@PeeHaa code works just fine
Let me ask you something
@Ocramius No it breaks now
Anonymous
@Daruchini Yep, exactly. That tutorial I sent you is a good starting point if you're trying to move away from frameworks :)
14:34
If you need to demonstrate it, make it a shell script that shows how it breaks, and I'll show you where you have a mistake
That code worked last build and now breaks
How can dependents otherwise defend against this? Target an exact specific version in composer.json?
Lemme check the composer.json
@JayIsTooCommon I have been looking at it quite a bit! It's just hard sometimes to filter the shit out of Google searches. Most commonly the resources I look at are 4+ years old, which makes me think is this still in data... Thanks for the help though. Much appreciated :)
And yes, this shouldn't break without composer.json changes, as you'd simply get a previous version
The problem in case it's not clear is as follow
14:36
@PeeHaa the mistake is obvious: github.com/ekinhbayar/gitamp/compare/…
@Ekin changed the composer.lock to install dependencies against her own environment
Updating dependencies?
What does that mean?
So obviously, travis says that it's not compatible with this env
@PeeHaa composer.lock change
huh?
ooooooh
14:38
huh
oooooooh
So the issue is install instead of update
I did a composer update, then fixed what amp complained re their latest changes
oh
Thanks @Ocramius :-)
@Ekin @PeeHaa hope that clarifies it :D
It does <3
14:40
It does
That said, please DO upgrade deps in minors - it is a healthy push for the entire ecosystem
We ain't WP
Anonymous
@PeeHaa did you at least giggle at the tweet I sent you?
I have no tweets?
Anonymous
whatsapp, few days ago
no worky
Anonymous
14:43
how can you not be authorised O.o
wait it works now
Anonymous
read the reply..
Anonymous
then open said picture
Anonymous
then please laugh and call me beautiful
ok that is funny :D
user924016
14:45
hmm
user924016
sounds like you guys are creeping it out (=
Anonymous
honestly, I'm just trying to make @Ekin jealous
go away
don't do that please :P
BTW @Ocramius let me annoy you more
I'll start the timer and send you an invoice later
14:50
Worth it
This means that composer.lock cannot be used anymore
I cannot share it with other people to make sure they run the same version as I do
When they are on other versions
You would have to make a composer.lock that supports all PHP versions
It took me some time to think about it again
update all the things!
the simplest way is to define a "platform" under config
Anyway, welcome to "THE REASON" why I don't commit composer.lock to libraries
:-P
You now experienced it first hand
It's not just for libs though
14:52
no, apps are fine with the .lock
projects have the same problem
you just have to decide which target environment you have
lemme check the platform thingy
we had this sort of reports hundreds of times already in the past btw - ZF bumped versions in 2.5 and 2.7
platform is somehow not working for me :-)
14:54
Isn't the point of semver to sort-of avoid these breaking updates?
That's why I usually run two test suites: one with composer update --prefer-lowest --prefer-stable, and one just with composer update
Should probably do that too
@Fabor semver explicitly states that dependency changes are not covered, as otherwise any transient API change would cause a breakage
Do you have an example of platform use somewhere for me?
PHPUnit changed internal phpunit-mock-objects major version multiple times, for example. You just never noticed because you never had phpunit-mock-objects at your root composer.json
yeah, lemme grab it
14:55
kk
@Ocramius That and it bumped at the same time as phpunit itself probably
@Fabor any symbol you explicitly use or require needs a respective dependency in composer.json btw - see github.com/maglnet/ComposerRequireChecker
run it through your projects to ensure you aren't forgetting anything
@Ocramius yes I saw that. But unless I am misunderstanding you that should be an array to build a lockfile with all versions?
@PeeHaa not really, major changed in minors
14:56
Ah I see
@PeeHaa no, if you define a platform it will always install with that platform
The easiest way to ensure compat is to always run composer update with the lowest supported PHP version you have
6 mins ago, by Ocramius
You would have to make a composer.lock that supports all PHP versions
although the burden is on the maintainer - contributors would always screw it up
Oooh all versions as in target the lowest?
@PeeHaa that defeats the purpose of composer.lock, which basically means "if you fail to install this, make everything crash"
14:59
Utterly confused now :D
.lock means "this, no alternatives, the end"
yes

« first day (2481 days earlier)      last day (2692 days later) »