« first day (851 days earlier)      last day (4323 days later) » 

10:00
You suck.
:7697347 "unexpected behavior" ???? you mean just wrapping it an a function can make me lose money ??
@PeeHaa lol
3v4l.org/I5L3F Well, sort of expected after 5.2.4
@webarto lol
wtf O_O
ah, not that much wtf
@webarto I blame @nikic
10:02
@Baba which A?
@Ocramius Its a BIG WTF .. more testing and you would be surprised the kind of ugly result have been getting
9
Q: Error getting current variable in the foreach loop

BabaHere is a simple loop $list = array("A", "B", "C","D"); foreach ($list as $var) { print(current($list)); } Output (demo) BBBB // Output for 5.2.4 - 5.5.0alpha4 BCD // Output for 4.4.1 AAAA // Output for 4.3.0 - 4.4.0, 4.4.2 - 5.2.3 Question : Can someone please explain what...

(late) Mornings
@hakre see the Update 1 - New Observation part
@hakre i can guess the BCD but the A is given me headache
@DaveRandom Good afternoon Dave
10:03
It confirms what @DaveRandom observed
it might be just me , but every time i look t Kingston (maker of the USB flash that i use) i read it as "Klingon"
Had a flat tyre
59
Q: How foreach actually works

DaveRandomLet me prefix this by saying that I know what foreach is, does and how to use it. This question concerns how it works under the bonnet, and I don't want any answers along the lines of "this is how you loop an array with foreach". For a long time I assumed that foreach worked with the array its...

Morning @DaveRandom - ouch, flat tyre AND snow...
@DaveRandom morning
10:04
@Baba didn't saw the question earlier. nice Q btw. now I have something to play ;)
@Baba What about you foreeach through a Iterator class to see what is happening?
But nothing still explains how a function changes output of array without modification
@Jimbo ...and lost the locking wheelnut key, ended up having to borrow one from a guy down the street that happens to be the same as mine
Bahaha - is one of those days eh
@PeeHaa tested and got AAAA
10:05
@tereško Kingston are the only manufacturer of flash that I've ever had fail on me, I don't by them any more, Corsair ftw
@DaveRandom It's 17mm I thinks
@Baba hmmmmm. Yup I blame @Nikic
Does it mean ArrayIterator is the only consistent way to loop over a array ?
@PeeHaa lol why ?
@Baba Just felt like blaming him
When in doubt blame somebody else
@PeeHaa Good Idea .. and valid reason .... i'll join you in the blame
@hakre What game ?
10:08
@Baba your array game. It has something to do with refcount.
@hakre I wish it was a game ... but this can be expensive
line     # *  op                           fetch          ext  return  operands
---------------------------------------------------------------------------------
   3     0  >   INIT_ARRAY                                       ~0      'A'
         1      ADD_ARRAY_ELEMENT                                ~0      'B'
         2      ADD_ARRAY_ELEMENT                                ~0      'C'
         3      ADD_ARRAY_ELEMENT                                ~0      'D'
         4      ASSIGN                                                   !0, ~0
@Baba 3v4l.org/IA951 - obviously 4.4.1 was broken.
I think answer is hiding ^ here
@Baba My foreach question has the answer to yours within it. It's all about COW, and in the case of foreach even a call to current() counts as a write because it affects the pointer. Although it doesn't actually move the pointer, they refer to two distinct copies of the same array, and treating them separately causes them to diverge. This doesn't happen with the item() function because they are then two separate copies of the array, you don't modify the array in the foreach scope
10:12
@hakre you mean i have to declare the array twice to get valid result when passing it to a function ???
@Baba I mean it depends on a lot what you do. Take care also that the item function should use pass by reference, right? And yes, foreach takes assignments of the $list variable into account, it supports PHP refrences and PHP has cow, too., 3v4l.org/mhr4k
@Baba No, foreach is fine as long as you don't want to modify the array during the loop and have those modifications affect the outcome of the loop. If you wan't to do that (although god knows why you would) you would have to iterate it "manually" while for/while and the array functions as appropriate.
@DaveRandom I still have serious issues with that item function because @hakre example proves otherwise ... there is a serious inconsistency issue here
@Baba first of all, PHP is backwards compatible, however, there are exceptions to that rule.
Exceptions are especially with god-language-constructs such as foreach.
@DaveRandom where exactly did the modification occur in here 3v4l.org/r2CkV
Let me make things worse
10:20
@Baba The one get's the array (as value) - that is the item function - the other get's the variable (which is an array) - that is the current construct.
$list = array("A","B","C","D");
item2($list);
function item2($list) {
foreach ( $list as $var ) {
print(current($list));
}
}
return AAAA
Opera formally adopts WebKit as its Web browsers reach 300 million users http://tnw.to/d0VLR by @jonrussell
@hakre look at this 3v4l.org/HrQ4D
does it mean ruing a loop in a function is different from ruing a loop outside a function
@Baba I already told you that 4.4.1 is broken.
@Baba it does mean that running a loop on something different than running a loop on something diffferent is running a loop on something different, yes.
@hakre it has nothing to do with 4.4.1 run the same code ousted the function you would get BBBB
10:25
@tereško WAT?
customer asked me to implement something. I did. Turns out it's not what he wanted. Told him it'll take another day or two to change it. Now he is unhappy because of (less than) a day's worth of work that he cannot use but has to pay for.
clients...
and people wonder why developers "cannot" estimate
@Gordon Sounds reasonable, I mean one can understand why he is unhappy.
@Baba You are confused by same code. Here is some same code, behaving exactly the same: 3v4l.org/ZZXbD
I'm happier working for a company than I was with "clients".
10:29
@PeeHaa Speaking of shiny features for stupid clients, how did you fair with the whole slow DOM/JS combobox thing?
@DaveRandom Worked out just fine. Changed it to textfields with JS autocomplete. They loved that shit.
@hakre Help me out here i see 3 different result in the same version here 3v4l.org/1aUpd
@Gordon It's like running a business. You're responsible for the economic results. You then told a developer what you want, turns out this didn't work. As you're responsible, you're unhappy so you get the right feeling that you need to improve something.
I think i give up now and i'll blame @NickC has @PeeHaa advice
@PeeHaa Thanks for the Suggestion
np :)
10:33
@hakre turns out this didn't work is relative, I once changed the damned website about 10 times, or made a feature that was ditched, and all for the same price (which didn't include 10 changes etc.), but you got to do that to keep them "happy". Well, no thanks, Sir.
@webarto yes, from the clients perspective.
@Baba There was obviously some change between 5.2.3 and 5.2.4, I'm just looking through the commit history and lxr to try and find it, and try and really understand what's going on. I have a suspicion this is partially because you are using current(), which the docs say takes it's arg by reference but I'm not certain about this because you can pass values straight in without assigning to a var and it doesn't complain.
@hakre failures in communication are to be expected, especially in our business where adding stuff involves creativity. And frankly, losing something that took less than a day when I initially calculated two or three is not a reason to be unhappy.
The truth of the story is, the if the developer is a freelancer, he is also responsible for the economic outcome ;) so he is happy for the extra work. the problem here is the dissent between the two parts that need to work together. I normally suggest my clients that with a proper budget and enough time this is no problem at all.
@hakre I am not responsible for the economic outcome. I am responsible for turning a vision into an application.
10:36
@Gordon yeah, one day is nothing. that is like sleeping once.
client might be just unhappy about the money. if it's a german client, this is the money he is talking about.
@Gordon Turning specification into code.
@webarto no. vision. specifications tend to be wrong most of the time.
ask those who provide specs, where the tests for the specs are.
just in case there are none, you know upfront.
Even specifications by really intelligent people who know what they are doing are usually wrong when you actually try and realise them.
10:39
@DaveRandom from what i see ArrayIterator seems to resolve the issue of consistency 3v4l.org/ViCNn
@DaveRandom this is why a specification normally ships with an example implementation.
@hakre Once some Spaniards sent me specs like that, I finished entire application in 3-4 days, would take a month otherwise.
@Baba The crucial point there is that iterators can never be used with references.
It's the references that are screwing you over.
@DaveRandom that i forgot ..... you have a way of given bad news when there a an atom of good news
anyway, only reason I am fussing about it is that this particular client always puts cost first. can be enervating at times.
10:43
@Baba Also an iterator is not a victim of the COW issue because it maintains a pointer to an external structure. It doesn't matter if it gets copied, the external structure is not altered and neither is the arrays internal pointer (I think).
I'm going to have to stop thinking about this for a bit, it's hurting my brain.
@DaveRandom I totally agree .... i Would just create some Unit test around this ..... thanks
@webarto been there, too. Custom Wordpress theme. Client changed the requirements three times in a row. Then would complain that we didnt send photoshop mockups first but used prototyping (so he had something to click on). My partner back then wanted to forfeit the extra cost but I insisted that the client pays for all the changes. He did. And was happy about the collaboration in the end.
10:59
@Gordon Yes, I agree. Only slap should be on the wallet, I was kind to do extra work for free, and they were always unhappy, but when they know it'll cost extra, they'll at least pretend. I made a website for 2000€, which generated 30000€ revenue in a year, and I was asked to upgrade it, I said the same price. And client got angry because it was too much, and it was in fact 50% less. Just charge and they'll "respect" you more, IMHO.
@Baba: Even the code is literally the same, the variables aren't. I think it can be best explained this way: 3v4l.org/jainJ
I makes the refcounts a bit more visible, as you can see things stay after the foreach and differ how the value has been assigned / set to the variable you foreach or current over.
@webarto funny, isnt it? It's kinda like showing a kid how far it can push you.
Especially take a notice on the refcount and if a variable is a reference or not.
Anyone like jQuery?
0
Q: jQuery UI Tabs - Multiple instances linking to same DIV set

JimboNote: I want to use `.tabs()` and avoid completely writing my own function to handle the fades and tab selections like others have found. As the title suggests, I want to have a list of tabs in two seperate positions on the page, but I want them to work together with the same data. The proble...

@hakre Clearly meant not write my own function and therefore not use jQuery tabs at all!! :P
@Jimbo Sounds a bit like a support request and not a programming questions to me I must admit. Especially taking the number of words inside the question and the line of code in the aimed-for answer into account.
11:09
@hakre I wanted to make sure my question clarified everything, I think it's a rather nice looking question. It has a picture and everything!
@Jimbo Yes, you sure put some love in there. You can just forward it as a support request to the vendor (print it as PDF so it fits into the email and does not get lost in case the question here is deleted - just in case).
@Jimbo two question: why cannot you make it in a simple native JS, and why the hell are you asking about jquery in a php chat room ?
When the vendor answers, add that information to the question as well (if it's not yet the answer) otherwise leave it as an answer for future reference.
@tereško might have a JS job, interested?
@webarto time, scale, monies ?
11:13
@tereško Well, I could do. I was rather hoping that something simple using .tabs() were already available - either way I think it's a good question to have up on SO as I can't see it being rare that something like this is sought after... as for PHP, that's why I asked "anyone like jQuery" :P
But, point taken
@hakre Good idea, will find out about the vendor and add to the question for future reference
@tereško few hours a day (depends on how fast you can finish task), probably $1k+, not sure about scale question? I think it's indefinite position...
i think you had my skype contact in the list : drop me some details about it
i love php but i don't like oop in php
its really bad
@webarto bottom line is this - i am interested , but i will have time to talks this out in 6-7 hours
@fibertech why? and did you just come here to tell us that?
11:19
@tereško I do, let me get feedback first, I was asked if I know somebody, but probably I'm not the only one asked... Sent your SO profile.
my SO profile is very little of JS in it
=/
ffs, I wasn't getting the Github confirm email message because it was coming in with a spam score of 9.3/10
i might need to work in that
@webarto I could answer stackoverflow.com/questions/10057671/how-foreach-actually-works, but it looks like an old question and not sure it's worth the time
@Gordon no no, i like this programming language but the oop realization is something strange i have never understood in php
11:22
@NikiC The fact you can answer it is important :) Sure, do the real work ;)
@fibertech so OOP in PHP is really bad because you have never understood it? That's an odd conclusion to draw, don't you think?
@NikiC Answer it and keep the link close so we can use it as reference when needed?
@fibertech which part of OOP you have a problem with in PHP ?
@tereško MVC
11:24
@fibertech maybe start here stackoverflow.com/questions/2206387/what-is-a-class-in-php/… for the very basics
@Gordon , i suspect that he does not like OOP in php because he could not find a framework that lets you do OOP in php
@Gordon That's a really cool post
@tereško maybe he will tell us
@Jimbo thanks. I am taking suggestions on how to rename the Lock class though. It interferes with the lock method (gets treated like an old style ctor)
Good Evening Everyone
@webarto @PeeHaa Btw, I think this answer stackoverflow.com/a/14849871/385378 is pretty good (for the specific question)
11:27
@Gordon But it gets the point across nice and easily - if you try and perfect it too much because of other people's pedanticism then it'll lose it's simplicity and with it the ability to educate newbies as easily.
pce
pce
hi @hakre If i am right, the accepted answer doesn't work: stackoverflow.com/questions/1659551/…
@Jimbo yes, but if a newbie tries the code it will output something and that might be confusing too.
@pce hi @pce, let me take a look & happy new year ;)
@NikiC Ah yes. Useful @jack is useful.
@pce and for which platform doesn't it work for you?
11:29
I would have just answered with: "Use Iterators :)"
pce
pce
@hakre thanks! for you too. I tried it on Linux (what else?), this answer works for Week:1 in Year: 2013 :
http://stackoverflow.com/questions/1659551/how-to-get-the-first-day-of-a-given-week-number-in-php-multi-platform#answer-14464025
@Gordon i know the principles and more something interesting in oop, cause i used to code a lot on delphi, c# and objective c, but i still don't understand a php's oop, u know all basics, also i know a lot of patterns of projecting like an abstract factory, singleton and others
@pce yes the accepted answer has serious problems. for example using timestamps calculated on seconds. depending on the input or what is being looked for, this just does not (and can not) work.
Take DateTime instead, the answer if from 2009
@NikiC It still gets a fair amount of traffic, I collect random upvotes on it quite a lot, and if you write out a better answer than the ones there I will accept it, I kind of understand what's going on (certainly with the examples I provided) but the answers are not totally obvious to passing people and if you can provide more info in a well laid-out way that would be good.
Also, do you know what changed between 5.2.3 and 5.2.4? I have just been trying to find a ref to the change (there was one, you can see from the 3v4l outputs) but I can't.
@fibertech so what is your problem with OOP in PHP ?
is it that you have never actually tried to understand it ?
11:36
@tereško it is 2 strange for me, yesterday i couldn't create a static class
the php interpreter gave me errors when i wrote "static class"
or "public static class"
since when static classes are "object oriented programming" ?
in c# i can simply define a public static class, but not in PHP
there is no such thing as a static class
@fibertech so , baseically , you never even bothered to read the manual
your conclusion that php's OOP is bad because ... because you could not guess the syntax
@tereško nothing in search engines about this, some methods to overload it, but there's no a static class natively
11:38
wonderful
@tereško the syntax must be simple to the human first of all
a have never googled such basics in c++, delphi, but in php...
@fibertech PHP does not have static classes, nor should you ever use them anywhere ever. If you want to mimic the behaviour, just declare every class member static and define a __construct() that throws and exception to prevent instantiation. But don't. I mean, the real solution to that problem is just "don't instantiate the class"
lol'd hardly
@DaveRandom in russia such methods are called "spikes" or "bugs"
php is not for you
go back to c# and stay there
11:40
may be, sure, i will agree to u
pce
pce
@hakre ok, thx.
Also classes don't have visibility, PHP doesn't have ring-fenced modules, it has namespaces instead.
so another question
Actually that's one thing I kind of wish it did have sometimes
anybody here knows something about databases, triggers and projecting patterns?
11:41
@DaveRandom next you will want friend classes
... also known as "the worst idea in c++"
what pattern is similiar to the prinicples of "triggers" in databases (singleton, abstractfactory, observer, adapter, decorator)
@tereško Meh, I just like the idea of private classes for things that are only used internally to a lib. Although again, the real solution is just "so don't instantiate it then" which is true.
@DaveRandom seems like something that would be a nightmare to test
@fibertech Database triggers are usually a sign that you're going to have a bad time, because you are moving business logic to the data storage layer.
@fibertech are you talking about observer ?
11:44
@tereško No, it would become something that you no longer need to test because it's not public.
@tereško i think, that adapter 2, can u explain your meaning about observer?
Y'know, test interfaces not implementations and all
it's a pattern - observer
@tereško right, observer is similiar, but i think that adapter can be a similiar pattern too
either you do not know how triggers work, or you do not understand adapter pattern
@Gordon so like using a trigger for select and insert in database? right?
@fibertech not at all?! it's completely different things. A trigger does something on a certain event, e.g. an update to the table. An adapter makes interfaces compatible.
@Gordon i think it's not too close to the role of triggers, but in some cases it is similiar, as i explained
@Gordon so u think that a question is not correct?
0
Q: PHP - what's wrong with my singleton?

kapsulawhat's wrong with my singleton? way it echo's me twice (11)? it should echo's me just one (1) even if it is invoked more than once? class A { private static $instance; private function __construct(){ echo 1; } public static function getInstance(){ return !self::$...

11:50
Can i list down all the tables from all the databases in postgresql
u have to know database names
I know all the database names
so u have to change your sql connector code each time u want to switch to another database
yes, i know if i try to do it that way, i am looking for somthing easy
11:52
@DaveRandom I'm just haemorrhaging rep on that Q
@Leigh lol
@Leigh Regarding GitHub email question yesterday: now I have added the email address I used for the stray commits to my account, the commits are linked to me as expected. So it looks like the answer is that your external commits will be attributed to the correct people as long as they have an account with the right email address on (although if you were using for ex. internal emails this would be an issue, since they couldn't add them to their account).
in codeigniter I am getting "Undefined variable: companyName" in whole project any solution. on PHP version 5.2 it work correct
@Nileshpatel define the variable .. the error message is in english, isn't it ?
@DaveRandom Nice, thanks for investigating
@Nileshpatel No it doesn't, you just didn't have error reporting enabled.
11:55
Damn that horse sandwich I had for lunch was tasty!
@PeeHaa Make sure you annunciate that properly if you say it out loud or it will sound like whore sandwich.
@tereško
error message
Severity: Notice
Message: Undefined variable: password
Filename: views/Inner_header.php
Line Number: 263
" />
@fibertech i think that triggers have nothing to do with adapters
which word is confusing you there , @Nileshpatel ?
@DaveRandom or whore's sandwich, that he stole from a working girl
11:58
@DaveRandom That would be even better
or even worse, sandwich is a euphemism
@DaveRandom After you change A records etc, is there propagation time or something? webarto.com and webarto.com are 2 different servers, not sure how to "redirect non-www" one.
11:59
can somebody close PHP.net bugs? If so, this one can be closed: bugs.php.net/bug.php?id=52858

« first day (851 days earlier)      last day (4323 days later) »