« first day (605 days earlier)      last day (4358 days later) » 

user895378
7:00 PM
Well, the PHP manual has been an excellent teacher for my purposes these last few years. I feel like giving back at this point :)
 
It's a shame that it isn't documented
 
Reflection is essentially for un-obfuscating code?
 
no
 
@Event_Horizon they are to dynamically call the code
 
@FabioCosta inspect and interact with. But not just calling
 
7:08 PM
Hmm, what uses does that have? When would you need to use that?
 
@ircmaxell Now the only thing left are the unsigned casts :)
ah, no, seems like you removed them too
Well, then great :)
Can't find anything new
 
:-D
I realized how they got in there
they were there before I extracted the function
so I was smart enough to put the cast in the call, but forgot to remove the other...
 
@Event_Horizon debugging (printing all methods of object X) making something that need to be changed at runtime, etc.
 
7:25 PM
Hey all
How do I do like this: stackoverflow.com/a/274919/561731 but with mysqli?
is it possible?
 
?
 
@PeeHaa is that to me?
 
Yup. Can't you just create 2 objects with the connections?
 
@PeeHaa doesnt allow it. connection refused.
....
 
strange. Use PDO! ;)
 
7:28 PM
I cant. our whole system uses mysqli
and I need to use 2 schemas... :-(
but one db server...
 
Sorry can't help you with this one
 
@Neal You really can't have two different objects that store separate mysqli objects?
Seems like you should be able to do that, given the design
 
0
Q: How do I connect to multiple mysql schemas at the same time?

NealAlong the same lines as this question: How do you connect to multiple MySQL databases on a single webpage? and its great answer, but that only answers it using mysql_connect. How do you do it with mysqli? I tried this: function connect($address, $account, $pwd, $name, $secondary = false) { ...

 
@Neal the code is ugly
that code is pretty much exactly the reason why you shouldn't use singletons
 
7:36 PM
@NikiC :-P
 
You would be better setting up a factory class
to handle your connection(s)
 
lool
 
@ircmaxell hm?
 
A factory should not manage instances
 
true
it is a complicated problem to explain in one line
i guess you could use a singleton that contains your connections
and then create a factory to wrap all DBs you would need to use
 
7:40 PM
Most people in this room stop reading at "use a singleton"
 
why?
singleton is a valid pattern
you just need to know how to use it
 
it is better to say singleton is a pattern ;]
 
"valid" != best practice
not even close
 
what is wrong with using singletons?
for a case that they are applicable for?
 
user895378
@afuzzyllama Do you write unit-tests for your code?
 
7:42 PM
yes
 
user895378
And how do you test the code that uses singletons in isolation?
 
There is almost always another way to do it, without singletons. But if you do any unit testing, singletons will become the bane of your existence.
 
@rdlowrey Nothing a simple replace in files can;t fix ;)
must.. resist.. to.. multiping... aaaafrgrh
 
I wrote a db connection handler singleton that was pretty easy to isolate and test
 
user895378
Not the singleton -- that's easy to test. How do you test code that uses your db connection handler in isolation?
 
7:44 PM
 
well at that point it isn't in isolation
 
lol
nice comeback...
 
how would you go about testing it without using a singleton in the same scenario?
your code is still dependent on your connection handler
 
user895378
Correct. The problem is that because there's one universal instance you can't mock the db connection's behavior. You can't effectively test code (and feel good about the results) if you have more than one variable in play. Your unit tests, like any other experiment, can't have more than one variable.
 
7:47 PM
why wouldn't i be able to mock by DB connection behavior?
 
user895378
Not to mention, you've tightly coupled your code to the singleton instance instead of using OOP best-practices to enforce interface design contracts.
 
@afuzzyllama , what if you need to connect to two different databases ?
 
the code I wrote could handle multiple databases
 
hmm, seems doubleton
 
i was doing MySQL, MSSQL and postgre
 
7:48 PM
no
i mean two databases at the same time
 
not really
the singleton worked off a factory
 
user895378
Fine, don't take my word for it. Google it. Or try this: Singleton is an anti-pattern
 
right
I've read the arguments against the singleton
I just don't think it is as evil as people make it out to be
if you do it right ;)
 
Now it's my turn to
 
@afuzzyllama I'm someone who isn't 100% against singletons, but I think you are ignorant to dismiss their thoughts so handily.
 
7:49 PM
@afuzzyllama , so , are global variable not evil too ?
 
user895378
In the end, they're no more evil than global state. Would you use global inside your class methods? If not, you shouldn't be using Singleton.
 
I am not ignorant
or dismissive
 
@afuzzyllama , how is a singleton different from a global variable ?
 
just asking quesitons
depends on how you implement it
 
how is singleton different from global variable ?
 
7:50 PM
if you reference your singleton in such a way where it isn't global
 
@afuzzyllama How ould you implement it without it being a global?
 
than it isn't a global variable
if you have a class that is dependent on your singleton, you can set a reference to it for that class
 
@afuzzyllama code example , please
 
not right now
 
@afuzzyllama that creates a tight coupling to the name of the class
 
user895378
7:52 PM
Obviously logging instances and database connections are cited as places where you need a singleton for preventing multiple instances of a resource. The better, more testable, less brittle option is to inject the single instance into any code that requires it. It requires way more thought in your design than does a simple global MySingleton::getInstance() call ... but that's not any different from the thought that goes into not using the global keyword.
 
I never used it as a global keyword in that sense
 
user895378
But it is the same as global
 
yes, if you use it that way
 
user895378
What other way is there?
 
I don't remember the exact way I did it, but you are right
it did require a lot more thought
 
7:53 PM
@afuzzyllama , please watch this : youtube.com/watch?v=-FRm3VPhseI&feature=channel
 
You are agree with all?
 
agree with that?
 
user895378
If I can call MySingleton::getInstance() from anywhere it is global, just hiding behind the static nickname.
 
*what?
 
when you are done , you can come back an discuss
 
7:53 PM
right
but if you can decouple that call inside the depending class
it can be quite nice
 
i have no intention to teach you basics of OOP , or explain how singletons are not OOP
 
you don't have to :)
 
please GO AND LEARN SOMETHING
 
@PeeHaa he am not agree with all
 
hehe
 
user895378
7:55 PM
I can't find the "Okay I am agree with all" meme image :(
 
brb, dumpster diving
 
programmers.stackexchange.com/questions/152617/… @rdlowrey just in case you were still interested in some easy rep
 
user895378
 
so, this is what PHP chat is like
interesting
 
May 7 at 21:55, by Carrie Kendall
user image
 
user895378
7:58 PM
@CarrieKendall sweet!
 
lol
 
user895378
@afuzzyllama If you hang out from time to time you'll pick up a ton of useful knowledge and good practices.
 
user895378
PHP chat is a shortcut to omniscience.
 
yeah, that is why I'm here
 
indeed, i've learned a ton already
 
8:00 PM
because I've learned a lot from SO so far
 
like how to generate meme's
 
but, I still don't agree with the "Screw singletons forever" mentality
 
user895378
Just keep an open mind and remember that people aren't calling you an idiot (most of the time), they're trying to help you.
 
@afuzzyllama yes, a constant nerd battle against the greater evils of programming. words like global, mysql_*, singleton, cakePHP remind us of what we are fighting for ^^
 
user895378
@afuzzyllama No, but you probably agree with "Don't use global" ... and it's the same principle.
 
8:01 PM
I sure do, lol
its just like people who hate on eval()
 
oh no.....
 
@afuzzyllama Now you are just trolling right? ;)
 
it is applicable in like 0.1% cases
that is why it exists
lol, no I am not
I'm just saying, I don't following information blindly
 
the words that @CarrieKendall mentioned are the equivalent of the word "it" to the knioghts who say ni
 
user895378
@afuzzyllama But there's still a more testable, less brittle option (dependency injection) in that 0.1% of cases, so there's no point.
 
user895378
@tereško wait, what? I'm still playing civ4 and I thought that was bad.
 
oh .. and , ignore the troll
 
I'm not a troll...
sigh
 
In other news poland - russia 1-1
 
hmmm .. the small picture jumped to the start of user-queue .. must be asking for more feding
 
user895378
8:08 PM
lol:
 
user895378
> My goal for the next few years is to try and end the war and thus use the engineers to clear swamps and fallout so that farming may resume.
 
user895378
That's long-term commitment.
 
@tereško i thought the purpose of ignore was to STOP talking to a person and/or reading their messages? :]
unrelated: sometimes I feel like i am learning in the wrong order
 
@CarrieKendall , well , you can still insult them , you just wont have to deal with backlash
 
thats crazy
10 years..
 
8:10 PM
@tereško insult away, it doesn't really bother me
 
i got tired after 3 days and downloaded a game trainer and got everything.. and anhiliated the world
 
some people have 10 year old WoW accounts
your point ?
 
thats a long time is all im saying
not knocking it..
 
user895378
I've had my facebook account for ten years! Wait ... hmmm ... somehow it just doesn't sound as cool.
 
my condolences , @rdlowrey
 
8:12 PM
lol reading some slides about URL Schemes that follow RESTful and it uses twitter as the bad example lol
 
user895378
@tereško I know I don't use it anymore ... it's just there
 
@tereško my wow account is about that old.. i dont pay anymore though .. i had it when beta rolled out for WoW.. played till cata and then dropped the acct
and helllooooo swtor
 
8:45 PM
also, note the comment dublicate ^^
 
8:57 PM
dutch school systems :(
Tell your teacher he is an idiot. And I know they are. I've been there, but still you should still just make your application safe. It basic stuff that is mandatory. — PeeHaa 51 secs ago
 
9:24 PM
104
Q: A real solution to ambiguous tags

Daniel BeckIntroduction Even within a site's relatively focused range of topics (it's unlikely anybody on SO will think sun refers to the solar system's star), some tags are inherently ambiguous. There are currently two unsatisfying options: Declare that the tag is only to be used for one of the possibl...

 
Sam
10:19 PM
Evening guys
 
hello @Sam
 
Sam
Hows your day been @PeeHaa?
 
@Sam pretty good. Got around to pushing some changes to my github so I'm happy
 
Sam
(y)
Roll on this weekend, im off work for a week and a half :)
Goddam you silly javascript error i cant find, its like whack a mole
 
500+ includes commented out to finally force autoloading, in one massive commit
 
Sam
10:26 PM
You know when your missing something painfully obvious, and as soon as you notice you just facepalm...
 
@orourkek lol
@Sam :P
 
@PeeHaa and now... we wait...
 
Sam
@PeeHaa What do you think?
 
:-)
 
Sam
What music do you like?
 
10:33 PM
Me?
 
Sam
And @orourkek but he seemed busy :)
 
dance, dubstep, electronic rock, lounge and others :)
 
Usually electronica/dubstep when I need to hunker down and grind through something, and classical/orchestral when I need to focus
Lyrics + coding does not usually work for me
 
Sam
Im like you @orourkek, i listen to Massive Attack when i need to focus, and a mixture of The Killers, dubstep, Owl City during grinding sessions
 
nothing helps you stay on track like blowing out your eardrums with WOMP WOMP WOMP WOMP BAAAAAAAAAAAAA WOMP WOMP WOMP
:P
 
Sam
10:40 PM
Da Da Da DA DUBSTEP -> youtube.com/watch?v=zyP20Wa0gDY
 
@orourkek :-)
 
@PeeHaa Did you menage to set up viper?
 
@NikiC Not yet. I have prepared my vps and I have changed the code to use postgresql instead of mysql. And I have looked into the source, but I'm not sure where to start at the moment. Will need to do some further research
:(
 
@PeeHaa You are using postgres?
 
@NikiC yep
 
10:52 PM
did you use mysql before?
 
@NikiC until couple years ago
 
Sam
Night guys
 
later sam
 
night @Sam :)
@PeeHaa What made you switch?
 
I switch initially because of Oracle and the uncertain future. But imo postgres is superior
In the beginning there were some things postgres was behind, but that is all (at least for the most part) in the past
Damn I cannot even type anymore
Anyway I'm off. I've got a client coming over tomorrow. And they tend to be in early :(
 
11:00 PM
I wished I was more open to new stuff :/
I'm terribly biased
@PeeHaa night
 
11:17 PM
@PeeHaa , far behind what ? in what aspects ?
only thing that was "far behind" was quotes for database size , which is why it was not used on shared hostings
 

« first day (605 days earlier)      last day (4358 days later) »