« first day (449 days earlier)      last day (4489 days later) » 

12:00 AM
@NikiC A reference to sports, where your "A" team is the best players you have. "B" team is the backups in-case of injury and to play some easy games. "C" team refers to the worst players on the team...
 
I still don't get it :(
@ircmaxell ahhhh
now i get it :P
 
Ahh, the "Americanism" of it
 
It's an American colloquialism
 
Ahh, the good ol' US of A.
 
12:14 AM
@CharlesSprayberry i'm svn checking out php-src now :)
 
@PaulDragoonis Awesome. I'm preparing a question for code review :)
 
Which proj/commit ?
 
what is this..
what makes this different from the existing stuff that's out there ?
 
@PaulDragoonis The fact that it is a learning experience. I'm not here to debate the worthiness of writing a framework. You can read codinghorror.com/blog/2009/02/… to understand my rationale
 
12:20 AM
yea, i've read that and cool.
i see a lot of code but not sure why it's useful for me to use this, if i wanted to.
r u building any projects w/ it
 
@PaulDragoonis It isn't to the point that I can do that yet, this is the project at the moment. But I have an idea for a project using the stack exchange API that I plan to use as my first example of a SprayFire driven app, so to speak
 
interesting..
 
@PaulDragoonis Ultimately though my very first interview for a development job came as a direct result of a predecessor to this project. I feel somewhat compelled to finish it.
 
@CharlesSprayberry good luck
 
12:28 AM
 
@ircmaxell That is so much more awesome than just
 
i think the overuse of references it going to do much worse to you app beyond a point where you care about performance
 
@CharlesSprayberry which is why I've started using it :-P
@PaulDragoonis amen to that...
I think I'm going to blog a reply to that post... That's such a bad message
 
@hakre Is it only me or does he have that smartass style of writing? (Not sure how to put that in words what I mean)
I mean he's writing it in scientific writing style and that just doesn't fit.
 
his benchmarks are completely flawed, because he never takes into count the case when refcount is > 1 prior to the method
 
12:37 AM
@ircmaxell yep
He didn't get at all why one shouldn't optimize with references
 
I replied to his blog post guys.
don't upset him too much,
 
The problem isn't that it can't be faster, the problem is that it often is unpredictable as it relies on how the var was used before
@hakre Where did you get this from? Did it show up anywhere important?
 
I got it passed along.
 
@PaulDragoonis moderated comment?
 
possibly.
 
12:40 AM
Ok, cause I don't see it (I was curious what you had to say)
 
@hakre Tagged with what? As in "Wow, look at that crap" or in "We need to add references to our code right now!"?
 
OMG not at all.
 
@ircmaxell can't see it either
@hakre Not at all? Didn't think of that variant :D
 
lol
 
First of all I didn't read the post that way that it actually says you should use references.
 
12:45 AM
lol
@PaulDragoonis: it appeared, and looks good...
 
okay thanks.
 
Hmm, the comment does not add much to what's already referred to of Schlüters posting that is referenced in the post itself...
Probably the headline was too catchy ^^
 
@hakre No, don't think so. I think it's simply pointless ;) (Or what is the message of the article?)
 
1:04 AM
hi guys, i need help
vertical-align isn't working right
anyone?
 
isn't there a CSS room ?
 
oh i guess i am in the wrong room then
 
this is the PHP room
 
well no one is in css room
?
 
@user1079641 please post your code.
 
1:07 AM
here?
 
I will go to the css room. post it there
 
 
2 hours later…
3:05 AM
quiet now :)
 
quiet indeed
whatcha working on @PaulDragoonis?
 
I've just finished compiling PHP 5.4 from source on my Macbook pro, as i'm making some changes to PHP
 
@PaulDragoonis Everything work out?
 
@CharlesSprayberry aye
im' running 'make test' for the guys to pick up any bugs
since we're in PHP5.4 RC5 now :)
 
Hey guys
Can anyone explain me, why this line giving sytax error inside class var $url = 'http://'.$_SERVER['HTTP_HOST']; ???
huh?
 
3:17 AM
@TuralTeyyuboglu please gist.github.com your code for us
 
gist: 1577026, 2012-01-08 03:17:59Z
class ws {
   var $url = 'http://'.$_SERVER['HTTP_HOST'];
   
    function __construct($db) {}


    public function getSettings($token) {
        global $db;
        $stmt = $db->prepare("SELECT data FROM settings WHERE token=?");

        /* bind parameters for markers */
        $stmt->bind_param("s", $token);

        /* execute query */
        $stmt->execute();

        /* bind result variables */
        $stmt->bind_result($data);

        /* fetch value */
        $stmt->fetch();

        return $data;

        /* close statement */
        $stmt->close();
    }
}
second line gives sytax error
 
You can't assign your class property actual variables upon runtime
you'll have to do that in your constructor
$this->url = $_SERVER['HTTP_HOST'];
 
ah ok
thx
 
you're welcome..
 
And you should also declare that as protected or at the very least use PHP5 modifiers for your class properties
 
3:20 AM
Yes, use 'protected/private/public $url' instead of 'var $url'
 
var=public
as far as I know
not?
 
@TuralTeyyuboglu No, var == PHP4 and PHP4 == bad
Technically it is treated as such but don't think about it like that
 
@CharlesSprayberry I read about this from hi-rep php devs blog
 
user47322
didn't php4 treat objects as copy by val?
 
Also, you really shouldn't want that public. That means that any code can change the state of that object. That completely defeats the purpose of encapsulating your data. The class should directly control its state. Right now your class isn't adhering to that.
@CharlieSomerville Yes
@TuralTeyyuboglu I would question the validity of the reputation of these blogs or the dates in which they were written.
 
3:23 AM
@CharlesSprayberry ok thx for info
 
var is an alias to 'public' in PHP5
yes, php4 treated object assignements by-val until PHP 5.0
 
Lets say I have, class a and b. B extends a. Can I use __construct in b? will it override a's _construct?
 
@TuralTeyyuboglu Yes it would. You can call a construct in b by calling parent::__construct();
 
so parent::__construct(); will be "second part" of main _construct, right?
 
@TuralTeyyuboglu I don't understand what you mean by "second part"?
 
3:37 AM
@CharlesSprayberry Lets say I want to call b class, with some input variables, and use a's functionality inside b. How b will get these input variables?
 
@TuralTeyyuboglu I still don't understand what you mean...one moment let me put a gist showing you an example
 
@TuralTeyyuboglu yes the child class's override of __construct() will prevent the parent's from being claled.
and within the child you can execute the parent manually by parent::__construct()
Does this he lp?
help *
YAY installed:
bash-3.2$ ./php -v
PHP 5.4.0RC6-dev (cli) (built: Jan 8 2012 03:03:04) (DEBUG)
 
I don't want construct parent. I want to construct new vars inside b class (like when we create simple class) But when I did it, my IDE told me that, you overided the parent's construct function
 
@TuralTeyyuboglu If you don't want to invoke the paren't constructor why are you extending it?
 
3:43 AM
@CharlesSprayberry To use other protected methods of parent
 
@TuralTeyyuboglu Those methods don't rely on the constructor in some way?
 
I'm new to OOP. So if I'm wrong, please explain, if it's not difficult for you
@CharlesSprayberry no
 
@TuralTeyyuboglu gist us your code.
gist.github.com
 
gist: 1577026, 2012-01-08 03:17:59Z
class ws {
   var $url = 'http://'.$_SERVER['HTTP_HOST'];
   
    function __construct($db) {}


    public function getSettings($token) {
        global $db;
        $stmt = $db->prepare("SELECT data FROM settings WHERE token=?");

        /* bind parameters for markers */
        $stmt->bind_param("s", $token);

        /* execute query */
        $stmt->execute();

        /* bind result variables */
        $stmt->bind_result($data);

        /* fetch value */
        $stmt->fetch();

        return $data;

        /* close statement */
        $stmt->close();
    }
}


class blocks extends ws {

    private $name;

    function __construct($name) {
        $this->name = $name;
    }

}
 
@TuralTeyyuboglu gist.github.com/1577095 Explains a little bit about inheritance and calling constructors
 
3:48 AM
ide says that second __construct overrides first one
 
@TuralTeyyuboglu Because it does. The parent constructor never gets invoked unless you explicitly call it
Take for existence in my example B::getParamData() overrides A::getParamData(). So, notice that A::getParamData() returns something entirely different from B::getParamData()
 
ok.so it's not necessary to invoke parents constructor, If i'm not using, right?
 
@TuralTeyyuboglu It is not necessary at all.
But I would :)
 
@TuralTeyyuboglu yes the second one prevents the first one from being called.
 
Ok, thx very very much,
 
3:53 AM
@TuralTeyyuboglu Out of curiosity, do you have a link to these blogs suggesting or using var class property declarations?
 
@CharlesSprayberry yep. one sec
 
Does anybody here have any experience with syslog?
 
@CharlesSprayberry dont ask to ask, just ask :)
 
@PaulDragoonis Indeed. Why would only certain priorities be showing up in syslog? LOG_ERR works for example but LOG_INFO and LOG_DEBUG do not
every other priority does work
 
hmm not sure
ask on stackoverflo main sie
site
 
3:59 AM
Ok
 
4:21 AM
Note: When you declare a property with the 'var' keyword, it is considered 'public'.
from this blog
 
@TuralTeyyuboglu That document appears to be 4 years old, and the information it is teaching was 3 years old at the time of writing. You must be leary and skeptical of a lot of PHP tutorials. It is easy to learn the wrong thing because there's a lot of wrong/outdated material out there.
Especially in PHP
 
@CharlesSprayberry so which sources are good in your opinion?
 
If you're just wanting to learn information about PHP I would go straight to the horses mouth: php.net
 
But it's like encyclopedy, not for learning
 
I disagree, I've learned a great deal from it :)
 
4:27 AM
ok. I'll let it a go
 
It is hard for me to answer that question. I looked at php.net and read a few key books
 
@TuralTeyyuboglu yes, it's for learning
read the language reference and know it
 
@ircmaxell wow. Hey, man!
 
But, I can tell you right now that the tutorial you linked is wrong. And I'm sure most of the people in this chat would agree with me.
 
wow what?
 
4:29 AM
The tutorial is teaching the use var $property declarations
 
@ircmaxell :D I mean nice to meet you
 
Oh, likewise
 
@TuralTeyyuboglu I like sourcemaking.com
 
@CharlesSprayberry ++, love that reference
 
@ircmaxell I actually think you were one of the ones that linked it to me :)
 
4:30 AM
@CharlesSprayberry good. I will read that
 
:-P
 
The great thing with that is they show a lot of different code examples in many languages
 
evening
 
Where would be the appropriate site for syslog questions on OSX?
 
you could try #macosx on Freenode IRC
 
4:42 AM
@PaulDragoonis It is more about the appropriateness of the question on the site. I have already asked on SO but it really isn't appropriate there.
 
well try there anyway
 
@PaulDragoonis I did that is my point. It is not appropriate there :) Before it gets closed I would like to flag it for moving to a different site, I'm just not sure what would be appropriate
 
ok, i'm not sure
4:44am right now
looking at php core
 
is anyone here?
i need some help in css and no one is in the css room
 
@user1079641 try ##css on irc.freenode.net
 
4:53 AM
@user1079641 I can maybe help you
 
i don't think the problem is that bad
can someone at least try to help me?
 
@user1079641 I can maybe help you.
 
ok could you please come in the css room? I will tell the problem there
 
I'm fairly adept at CSS as well. No wizard or anything but decent enough I suppose
 
well, it would be great if you join us too in the css room. It would help a lot
 
5:25 AM
Guys, is there any class (or maybe inbuilt function of php) to create html elements like div, a ... etc?
 
@CharlesSprayberry but this is parser
 
DOM is not just a parser
You can create elements in the DOM
 
5:44 AM
@CharlesSprayberry He just needed a robust three column layout with a footer. Sent him to an article from alistapart
noobs trying to reinvent the wheel :)
 
@LeviMorrison thx for "noob":)
 
@TuralTeyyuboglu I don't use the term negatively, simply to refer to the fact he is new :)
 
@LeviMorrison I'm not new, for info. I just tired to mess markup with logic. That's why looking for programmatic way
similar to JavaScript's DOM manipulation
 
@TuralTeyyuboglu Oh, I wasn't referring to you. I was referring to someone who popped in a bit earlier.
 
@LeviMorrison ok. my bad
 
6:04 AM
@ircmaxell I have started to separate my RFC into multiple ones. I have the basic outline for datastructures: wiki.php.net/rfc/spl-improvements/data-structures
I'll be separating the exceptions portions out shortly.
Hopefully.
It's pretty rough right now, I'm just trying to separate the data for now.
 
 
2 hours later…
8:13 AM
Using References to Improve Performance in PHP - miqrogroove.com/writing/php-references-for-speed
 
 
1 hour later…
9:40 AM
0
Q: Understanding RESTful. URIs for complex actions

InnuendoI'm trying to build a RESTful service, and I've faced with some problems. I'll describe these problems (questions) with an example of an imaginary RESTful service. For example, I need a "News" service on my site. News can be of different types: local news and global news. News are added by admin...

 
10:45 AM
Good morning
 
10:58 AM
bonjour
 
11:48 AM
Just wrote a response to that crappy article
 
hello, can please anybody tell me how get the category of post and display an archive of that category in the sidebar?
 
Hi @NikiC: Where?
 
i mean, i just need to know the code to get the category, i have this


<div id="pagine">
<?php
$category = get_the_category();
if($category[0]){
echo '<a href="'.get_category_link($category[0]->term_id ).'"><div id="pagine"><ul><li>News su '.$category[0]->cat_name.'</li></ul></div></a>';
}
?>
</div>

but it displays the wrong category for some reason
 
@hakre Comment. Needs to be moderated though ^^
 
@FilippoBonino: Please checkout the wordpress channel: chat.stackexchange.com/rooms/6/stoppress
 
11:58 AM
@hakre thanks
 
btw, @NikiC, just running your evil array example code.
That's really a bummer. There won't be any fix for PHP 5.2, right?
 
@hakre Nope, 5.2 is EOLd. But I think there is a 5.2 patch by laruence
@hakre How long did it take for you?
 
To execute? ~30 secs with 16. (31.579704046249 seconds)
 
@hakre Ah, so same result as I had.
 
The idea is to create a serialization of the array and SQL-inject those into the wordpress option table that is autoloaded on each startup ^^
Ah I've got another idea, let me test this....
> Unserializing 32768 evil elements took 7.7345659732819 seconds
> Inserting 32768 evil elements took 7.6765120029449 seconds
(that's 15)
 
12:09 PM
@hakre The bad thing about unserializing or decoding is that it isn't fixed by the max_input_vars thingy ^^
So that attack vector will stay
 
yes :)
additionally, if you get it into the DB, it will stay on every request.
 
12:24 PM
since when does __call exist? php5?
 
jup.
5.0.0 at least.
Are you concerned about PHP 4?(???)
 
0
Q: Method name clashing with language construct

DaveRandomI simply want to name a method in my class list(). If I try and do so: class MyClass { function list () { // Do some stuff here } } ...I get a parse error (Unexpected T_STRING...). The same is true if I use echo or print - so I am guessing that I am not allowed to name a class method...

one answer suggested to use __call (now changed)
 
1:04 PM
now that genesis is no longer repwhoring we might make Michael the champion of repwhores. ive seen him do that quite often. he even opened a post for it on meta: meta.stackoverflow.com/questions/91180/…
 
Hey guys
$head->appendChild('<!--[if !IE 7]> <style type="text/css">#wrap {display:table;height:100%} </style><![endif]-->'); trying this code, but it gives me following error Catchable fatal error: Argument 1 passed to DOMNode::appendChild() must be an instance of DOMNode
 
@NikiC It shouldn't though. That's why they are talking about a different fix: namely randomizing the hash function
 
@ircmaxell please take a look at my question
@ircmaxell how can I fix this error?
 
@TuralTeyyuboglu look at what the error says
 
@ircmaxell I know ^^ It's just that that's harder to fix than it sounds.
 
1:12 PM
absolutely
and the max_input_vars fix also works on serialized input
 
@ircmaxell hum?
 
@NikiC at loeast that's what the discussion indicated
 
@ircmaxell no, no
 
@ircmaxell how could that be?
 
no?
 
1:13 PM
laruence wanted to do that but we decided not to
 
unserialize is no input function.
 
@TuralTeyyuboglu this is a comment node
 
@Gordon ?
 
plus to hint DOMFragment here to import bare XML.
 
Because it a) doesn't make sense to fix all functions that somehow work with arrays one by one b) unserialize()ing a large array is probably something that many applications do routinely and would be broken by that restrictoin
 
1:16 PM
@TuralTeyyuboglu Please see:
3
Q: PHP DOM - append source html to a DOMElement

fabiois there a way of appending source html into a DOMElement? Something like this: $trElement->appendSource("<a href='?select_user=4'>Username</a>"); it would parse that fragment and then append it. thanks in advance!

 
@TuralTeyyuboglu appendChild appends a DOMNode. Your <!-- blah --> is a comment node, so you if you want to appendChild that, you need to create it with php.net/manual/en/domdocument.createcomment.php. If you want to append the entire snippet you show, see hakres suggestion
 
ah ok
thx
 
@Gordon Omg, your answer is very clear
@Gordon thx very much
 
@TuralTeyyuboglu your welcome. feel free to upvote ;)
 
1:21 PM
@Gordon of course
 
@TuralTeyyuboglu thanks :)
 
@Gordon good to see I’m not the only one trying this cool stuff
@Gordon One more thing
Can I use $head->appendChild($css, $altcss); instead of
$head->appendChild($css);
$head->appendChild($altcss); ???
 
@TuralTeyyuboglu: No.
 
I mean is there anyway to append multiple nodes at once?
 
1:25 PM
See as well the documentation of the function, it tells you which parameters and in which order are accepted: php.net/manual/en/domnode.appendchild.php
 
@TuralTeyyuboglu see my answer in the link hakre gave above: stackoverflow.com/questions/4751437/…. the only other way to append multiple nodes at once is by importing them from another document.
 
programmatically manipulating with html elements in php - that's really cool.
Yesterday I found this feature of php:)
 
1:43 PM
@TuralTeyyuboglu: Yes, DOMDocument is worth to learn about, it's a very good PHP extension in my eyes.
 
wow
i mailed some of the bigger names in computer science and got a lenghty email back.
didnt expect that *happy*
 
2:06 PM
@Gordon who is that?
@Gordon And what was it about? The agile communication thingy?
 
@NikiC yes
@NikiC you might remember i posted two links to videos about DCI recently. I contacted one of the speakers and asked whether it was coincidence that it contained - what i identified as - theories from communication science. The answer is three pages long and contains two pdfs
i need some time to reflect on that but on first read it looks like its just what i was looking for
it closes a gap i couldnt close on my own before where i want to go with my thesis
 
sounds nice :)
 
2:22 PM
@Gordon dude, nice
 
it is. i'm completely blown away by the answer (even though i dont fully grok it yet). i expected a few lines with a "look here" if anything at all.
 
Imagine what will happen if humans have managed to more successfully talk with computers.
 
2:42 PM
0
Q: What am I doing wrong by splitting my array on odd/even numeric keys?

knibalsI'm having trouble splitting an array in two. Array ( [0] => livree [1] => 2011-12-26 [2] => livree [3] => 2011-12-27 [4] => livree [5] => 2011-12-28 [6] => livree [7] => 2011-12-29 [8] => livree [9] => 2011-12-30 [10] =&g...

That question seems to have attracted folks who can't write code.
 
@salathe lol, the answers are really funny
 
http://stackoverflow.com/questions/8778324/how-to-parse-xml-file-using-php-domdocument
 

« first day (449 days earlier)      last day (4489 days later) »