« first day (640 days earlier)      last day (4301 days later) » 

4:00 PM
where catastrophic release means "complete rewrite"
 
apache says it cannot find a page
 
@DineshVenkata are you referring to socialengine.com ?
 
@mabi yes
 
@tereško yeah, that could be one of the reasons, although simpler stuff is (probably) the same... and you are right :) f* this s* they said, rewrite v3 they said
 
@cHao Well, I can't observe the long-term effects because I've only been using Dart for 8 days, but so far I like it a lot.
 
user895378
4:01 PM
@cHao Remember the other day when you said Fedora drove you nuts and you couldn't use it anymore? Well I immediately had the same experience. Everything kept crashing and I lost an entire day in OS hell. I promptly dropped F17.
 
@webarto , well , 3.x was huge improvement over 2.x
 
@DineshVenkata then the answer is "no", sorry.
 
@Neal the problem has been solved with a java script event handler, thanks
 
@tereško yeah because they ditched CI leftovers... 3.3 is in development, 3.4 is planned, and I'm guessing if 4 will be a complete rewrite :)
(one beautiful sunny day)
 
4:03 PM
@webarto and the other thing is : tutorials are written by two types of people - developers and people who rewrite manuals using different words .. Kohanas manuals have always sucked , and developer don't have time to waste on writing for Nettuts+
 
@cHao Also, you don't have to have factory classes to return your one implementation for an interface. So in a framework setting, when someone needs to use an interface to hook up to their code, they already know where the factory is as well.
 
@LearnerExpress oook
 
@ircmaxell I feel like that 6.0 thread isn't particularly productive ^^
 
@NikiC Howover I would like to see "something".toupper() and stuff like that
 
4:06 PM
@tereško your definition is true, I think contributing to documentation for free would be of greater value than writing tutorial for small amount of money...
 
*"something"->toUpper();
 
@NikiC No, it's going off hand
 
haha :P my bad
 
@NikiC link?
 
@tereško that's a pretty horrid "question" you just linked... some peoples kids
 
4:06 PM
But it is good to start talking about "fixing" API's again imho
 
@Justin , that why it had the close-vote tag
 
@LeviMorrison still not subscribed to internals? :P
 
I demand array_rand_values... :)
 
@webarto write it yourself ^^ it's three lines or something like that
 
@tereško I know... wish i could cv it... Still surprises me how often questions like that show up...
 
4:09 PM
4 hours ago, by webarto
function random_sentence_spin($str)
{
    $new_str = preg_replace_callback('/\{([^{}]*)\}/im', function($matches) {
        return explode('|', $matches[1])[mt_rand(0, substr_count($matches[1], '|'))];
    }, $str);
    if ($new_str !== $str)
        $str = random_sentence_spin($new_str);
    return $str;
}

$rand_sentence = "{Please|Just} make this {cool|awesome|random} test sentence {rotate {quickly|{fast|slow}} and random|spin and be random}";

for ($i=0; $i < 10; $i++)
    echo random_sentence_spin($rand_sentence) . PHP_EOL;
@NikiC 4th line would be much sweeter :) :P
 
@NikiC Just digest. I should switch.
 
@LeviMorrison You should ^^
 
2
Q: Which is the best practice to access config inside a function?

hookman<?php define('ABSPATH', dirname(__FILE__)); //Absolute path to index /* * Method 1 * Dependency Injection */ class Config{ private $_config = NULL; private $_filepath = NULL; public function __construct($filepath){ $this->_filepath = $filepath; $this->load(...

 
is there really such a thing as a static class?
 
> You MUST NOT use this function for any other weird games
 
4:14 PM
@hookman I would at least create an interface so you can easily use different config styles and static is "never' the right way ™
Eeeeek and don't use global ever
 
@PeeHaa what about Dependency Injection?
 
@hookman Now we are talking
 
businessinsider.com/marissa-mayer-ceo-of-yahoos-career-2012-7 awesome, works 13 years, quits in few days...
 
@hookman p.s. why do you people hate curly braces so much :(
Have they done anything to upset you at some point in your life?
 
@PeeHaa oh, that habit, brrrr. I'll fix that
 
4:20 PM
@hookman :-)
 
^ wontfix
 
@Neal , do you really think it was a good idea ?
 
@PeeHaa why the hate for static?
 
because they are global variables by different name
 
@orourkek besides global and tight coupling?
 
4:23 PM
for config variables?
 
for anything
 
@tereško why not? It could help :-)
bash me all you want
 
no point
 
@PeeHaa braces fixed)
 
you can just check chat history
 
4:26 PM
And yeah, everyone who isn't using PDO should be punished. Well, apart from @ircmaxell :P
 
maxell is as mysql-only developer
 
@NikiC You forgot the duck for cover part ;)
 
@tereško No I'm not. I've used mongodb and postgres before as well
 
@PeeHaa Nah, I'm a mysqli hater and proud of it ^^
Because I really hate reading code using mysqli ^^
 
"used" , sounds like something you did in the past
 
4:28 PM
@NikiC why is that?
 
I'm not using MySQL today either. I'm not using any database engine...
 
@Neal Because I want to read code, not boilerplate ;)
 
@NikiC explain?
 
Nah, busy right now. Ask @PeeHaa
 
@PeeHaa ?
 
4:30 PM
Did I hear a summon
 
@PeeHaa yes
 
lol
 
@PeeHaa if you've got multiple possible site configurations (ini files), what would you propose as the "acceptable" container for those configurations? (serious question)
 
For starters the fact that you can use other engines when using PDO, I like the APO provided by PDO better (may be personal preference, but I'm like that) and have you seen the prepare stuff?
 $stmt->bind_param("abccdefhgijklmdjkhdsjghfjsdghfjsdg", $var, $var, $var);
 
actually, I'm going to have to use PDO soon...
 
4:33 PM
i just dislike mysqli's naming convention and lack of named parameters
 
@ircmaxell You are being converted? ;)
 
no, because odbc_*is fubar beyond PDO
 
:P
 
heh
@Neal , what is the point of this class ? /smallFry/application/Pluralize.php
 
I'm happy! I'm getting to play around with a Terradata box!
 
4:36 PM
@Neal I just do see any reason to use mysqli. And I don't care if someone uses it in "private" code at all. I'm happy when I don't see use of mysql_* (it's sad I know), but I can;t be bothered with it
 
@tereško I know I'm not Neal but what everybody uses Pluralizer/Inflectors for: database table names github.com/maniator/SmallFry/blob/master/smallFry/application/…
 
a $3million database server... :-D
 
@Neal Why aren't you docblocking your code when you want others to use it?
 
@CharlesSprayberry , yeah , which is why i asked "what is the point of" instead of "what does it do"
 
Also I think that mysqli is actively harming the mysql_ migration ;)
Because when people see mysqli code they think "are you serious?!? I won't use that shit"
 
4:39 PM
yeah , people just "i" to the old mysql_* code and look smug "see , i am not using the old mysql API anymore"
 
@CharlesSprayberry exactly
@tereško So that way my models know their table names.
 
... enough ... i cannot go on
 
@tereško How else would the model know the table name without explicitly telling it?
 
well .. that is the point where you go wrong
 
@Neal Is there something wrong with explicity telling the table name? Did I miss that memo? (honest question)
explicit all the things!
 
4:46 PM
@PeeHaa lol, no, but it makes things easier. That way I have a Model called "Tasks" its table name will be "tasks" unless I change it explicitly (which I do have the function for)
 
@PeeHaa , he's from RoR/Cake school of "mvc"
 
@Neal Why would a model === tablename?
 
@PeeHaa It wouldn't. it would be it's plural
@tereško yea, thats basically where I got the idea....
 
as i said already ..
 
@Neal Maybe it's the beers, but I don't get it
But my typing improved though so that's a good thing
 
4:49 PM
@PeeHaa , have you seen activerecord implementation in php ?
or actually maybe made one yourself
 
@PeeHaa So if I have a model class "Child", its corresponding table could be "children"
And that is what Pluralize does.
 
@tereško both actually, that's why I don't get it ;)
 
I think the mistake with the Pluralizer is that you are explicitly tying your Model to a database table. Model !== database table
 
5 mins ago, by PeeHaa
@Neal Why would a model === tablename?
Is it "don't use curly braces day" today? stackoverflow.com/questions/11527150/…
btw classic:
 require_once( dirname(dirname(dirname(dirname(dirname(dirname(dirname(__FILE__))))))).'/wp-load.php' );
dirname all the things!
 
what in the hell
 
4:54 PM
@PeeHaa , while i can appreciate dubstep (mostly because of extensive exposure to industrial noise and basic musical education ) , this one is kinda weak =/
 
@CharlesSprayberry But that is what my Model does. I originally did not have a model. See the early commits. I was convinced by the powers that be over here to have one ^_^
@PeeHaa wth
 
@tereško :(
 
I really need a plugin for Sublime text 2, which makes BIG ALERT MESSAGE when i forget to use braces
 
Well you can't have it all ;)
@hookman Just share your code here often and allow me to yell at you ;)
 
@PeeHaa lol
 
4:56 PM
@PeeHaa , i have done it too ( in the first month of using php )
 
@hookman Not sure if there is a Sublime plugin but you can have a look at pear.php.net/package/PHP_CodeSniffer/redirected
 
well .. except the wordpress
 
hehe
 
@PeeHaa bookmarked
@PeeHaa ty
 
@Neal , convinced by who ? who convinced you that you need multiple models which map directly to tables ?
 
4:59 PM
@tereško What is wrong with that? Moreover, a model does not ness have to do with a db table in my MVC, it just usually is.
 
@Neal I realize that, I just don't agree with it. Getting data from a source is not a direct responsibility of the model layer and belongs more appropriately in some data access layer.
 
Why do I always spend amazing amount of time on architecture building than on application itself?
more on architecture building than on application...*
 
@CharlesSprayberry , well , data access structures would be part of model layer .. but then again , he does not have a layer , he has a list of objects
 
@hookman It's a good thing though. It prevents you from throwing away stuff later, helps you to think things thourgh before doing it, prevents you from making it hard to change your stuff later on
 
@hookman , because that's how you improve
 
5:01 PM
@CharlesSprayberry So which layer handles the db? I always thought it was the model.
 
@tereško Sure. But the actual retrieval of the data is a direct responsibility of that data access layer. The Model itself should not, imho, directly access some data source.
 
@tereško How is mine not a layer? I want to learn...
 
I'm always improving instead of doing the job))) The client doesn't care about the architecture, he cares about time:)
 
@hookman True. That's why you also invest time during off hours :-)
 
> Weeks of programming can save you hours of planning.
 
5:05 PM
@hookman Or when you have a great job you will be ofefered time on the job to improve yourself. Hard to find those though
 
@PeeHaa I would study OOP patterns, maybe framework, but as i don't have that big projects to use all that stuff. Without practice it makes no sense.
 
what's the good word?
 
ba ba ba bird bird bird
 
lol
 
5:11 PM
the bird is the word
 
BA BA UMA MAO MAO MAO
 
Hasn't everyone heard?
 
I thought you would have heard the news of a certain ornithological variety?
2
 
lol
 
lol
 
peter never goes as nuts as in this episode
 
holy cr@p... teradata supports up to 92 Petabytes of data on 4096 master nodes... Good bloody god...
 
Watcha gonna do? Build a rainbow table on that beast?
 
@AlvinWong, are you new here? :D — Adnan 1 min ago
lol
 
5:24 PM
@mabi yes, of every possible 56 character password...
 
Awesome. ;)
/me gets a page from the dragon book as password
 
@PeeHaa :
3
A: Switch to mysqli or stay with mysql?

GordonQuoting the manual for ext/mysqli: The mysqli extension has a number of benefits, the key enhancements over the mysql extension being: Object-oriented interface Support for Prepared Statements Support for Multiple Statements Support for Transactions Enhanced debugging capabili...

Never was suggested to go PDO
 
Granted, the cost for such a database is $5.4 BILLION per year...
 
How hard is it to switch my mysqli code to PDO without breaking any sites running the current version of the code?
 
5:33 PM
generic question is generic
 
42 hard
2
 
@PeeHaa thanks for the answer and provided info
 
no, and I'd like to keep it that way
 
@ircmaxell oook then....
 
user895378
5:35 PM
lol
 
user895378
zingggggggggggggg
 
Do I really want my friends to see my privates?.... — Neal 3 mins ago
 
@Neal no - your friends should only care about your public members
 
Hmmm Implementing and ORM like Doctrine shouldnt make mantainence easier ?
 
@Neal First thing I noticed is the mixing of Camel Casing naming and Underscore naming
 
5:39 PM
@Event_Horizon Where? I thought i had fixed all that, guess I missed a few.
 
if(!$consistent){exit;}
 
@LeandroArielPezzente It depends.. short answer is Yes. Long answer is you can shoot yourself in the foot just as easily with something like Doctrine if you don't have the knowledge and discipline to use it correctly
 
you never saw a Java's swing code , dont you ?
 
@Neal the two files you linked from github
function useSecondaryHandle
function get_row
 
Like using a mix of camel and hungarian notation ....
ORMs like DOctrine and Hibernate do become a nightmare whenever your Entity Model changes , yes.
 
5:42 PM
@Event_Horizon Hmmmm Those classes were written abt a year apart from each other. the MySQL class I haven't touched since I made it. since then I have switched to camelCasing.
So I should update it.
 
user895378
I wouldn't necessarily agree with the blanket statement that one should do away with private. Not all algorithms should automatically be subject to modification by child classes. Composition is generally preferable to inheritance. Judicious protected usage can go a long way to keeping the black box "black." — rdlowrey 9 secs ago
 
user895378
@PeeHaa
 
@Xeo I only let close relatives see my privates. It would have to be a very close friend if I let them see my privates as well. — Neal 2 mins ago
 
Are you using a relfection api ?
 
@LeandroArielPezzente eh?
 
5:45 PM
@Neal , what are you using a reference to a static variable ?
 
Usually , whenever you use reflection , you should agree to a consistent , coherent casing , in order for your getters and setters to be identified properly.
 
user895378
Usually, whenever you use anything you should agree to a consistent, coherent casing.
 
@tereško Where?
 
ORMs like Doctrine , since they are Hibernate ( wich uses Java Reflection API and Beans notation rules) , might well be using PHPs reflection API themselves.
 
5:46 PM
@tereško ahhh yes, bc I only want to connect to the DB once
 
@LeandroArielPezzente They are for sure since they use all that docblock annotation stuff
 
how exactly did you manage to get 30k+ rep ?
 
too slow
 
way too slow
 
5:48 PM
@tereško Wadya mean?
Rep has nothing to do with knowledge lol
most of my rep is from javascript/jQuery
 
@MikeB Thanks ! Got it !
 
@Neal what's the question?
 
@Neal , global state and singletons are kinda "language independent" thing
 
@tereško eh? Could you explain?
 
5:49 PM
@Neal It's a bad thing in all languages
 
I know singletons are bad. but in this case, i needed em
 
Not just PHP
 
@Truth what is?
 
@Neal Why do you need them?
 
user895378
5:49 PM
No one in all of recorded time has ever needed a singleton
 
@Neal , just watch the damned lecture : youtube.com/watch?v=-FRm3VPhseI
 
Recommended very much
 
actually you can do something similar to Singletons without Singletons
 
Problems with singletons are mostly with Thread Safe vs Performance Issues.
 
5:50 PM
we will check back with you in an hour
 
user895378
:4563815
 
@tereško I am @ work. can't watch videos.
 
user895378
Problems with singletons are mostly that they're very hard to test.
 
@rdlowrey this
 
@rdlowrey , wrong
 
5:51 PM
@Neal The database connection should be given to objects/methods which needs them
 
How else can i make sure that the DB is only created once (or twice for 2 handles)
 
gyro my best friend
 
@Neal Only create one object
 
user895378
Aside from global issues, obviously.
 
It shouldn't be in the global scope of the entire application.
 
5:51 PM
@CharlesSprayberry But let us say that the user wants to use 2 db schemas / 2 db connections?
 
user895378
It was a rhetorical statement in response to:
 
Also, what if by any chance you ever need to connect to another database at a time?
 
user895378
1 min ago, by Leandro Ariel Pezzente
Problems with singletons are mostly with Thread Safe vs Performance Issues.
 
@Neal Then Singletons aren't good for you either!
 
@rdlowrey lol there are no threads in my code.
 
5:52 PM
@Neal or separate database for each user
 
user895378
Which should have nothing to do with why one would choose a singleton
 
@webarto LOL :-P
 
You preffer to risk to unsafe threads and probably data corruption instead ?
 
user895378
@LeandroArielPezzente you've confused needing a singleton with needing a single instance of a class.
 
@rdlowrey Ok. So how do I make it so all Models in the MVC are using the same MySQL connection? Dep Injection?
 
5:53 PM
49
Q: Why is Global State so Evil?

TruthBefore we start this, let me say I'm well aware of the concepts of Abstraction and Dependency Injection. I don't need my eyes opened here. Well, most of us say, (too) many times without really understanding, "Don't use global variables", or "Singletons are evil because they are global". But what...

 
I did that for Config, so I should do the same for DB?
 
@Neal Yes, that's exactly how you'd use it.
@Neal What Config?
 
you implement a singleton pattern whenver you need a single instance of a class.
 
6
A: How to properly setting up PDO connection

tereškoI would recommend to use both anonymous function and factory pattern for dealing with PDO connection. The use of it would looks like this : $provider = function() { $instance = new PDO('mysql:......'); $instance->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $instance-&...

 
Its what the pattern was designed for.
 
5:53 PM
Global application configuration should be with constants.
 
@LeandroArielPezzente , please shut up , you do not understand OOP , so , don't try to help
 
@LeandroArielPezzente If you need a single instance of a class, you use a single instance of a class
That doesn't make it a singleton.
 
user895378
@LeandroArielPezzente but it's AN ANTI-PATTERN because it introduces state and is impossible to test.
 
user895378
There are much better ways to limit instances of a class to one.
 
@tereško isnt the factory basically using a global fn?
 
user895378
5:54 PM
That don't introduce global state and are fully testable ...
 
@Neal where ?
 
@Neal Yes, it is
That's the actual app, the only scope possible for that is the global
 
@Truth no , it isnt
 
@tereško Well it essentially holds all of the class information. So I should "create" all the models using the factory?
 
Eventually, something has to go on the global scope
That's the actual functions which run
@tereško You'd probably be able to explain it better than I can
 
5:55 PM
I think this one youtube.com/watch?v=RlfLCWKxHJ0&feature=plcp also explains how to build things as testable well.
 
I'm not very good when it comes to English technicalities.
 
user895378
There's nothing wrong with global scope. Global state is where the monsters live. Every application needs to be wired together somewhere and that happens in the global namespace (or roughly equivalent main() function)
 
@tereško Also this would only work in newer versions of PHP....
if I use older versions, the anon fns would fail
 
@Neal , if with "newer" you mean php 5.3 which is already 3 years old
 
5:57 PM
High Encapsulation is Gooooooood
 
@webarto LOL
 
@tereško Well, doesn't $provider and $factory both are found in the global scope?
in your example
 
@tereško There are webapps at our company using 5.1
 
how do I get rid of it :(
 
@Neal How about you upgrade?
 
5:58 PM
@Neal , last update in 5.1. branch was 6 years ago .. you really should upgrade
 
when I started working in new company I've spammed them until they've upgraded to 5.4.3 at the time
which was 2-3 days
 
You should be able to upgrade with minimal refactoring of existing apps
 
OMGOMGOMGOMGOMGOMG URGENT!
[cv-pls]
 
@tereško lol thats not me. thats my office. the main webapp box uses 5.3.6 which I assume I can use anon fns?
 
bah i cant tag =(
 

« first day (640 days earlier)      last day (4301 days later) »