« first day (537 days earlier)      last day (4423 days later) » 
00:00 - 17:0017:00 - 00:00

user895378
Wow, that one's just brutal.
 
12:41 AM
I'll be speaking at #NYPHP in the coming months, what would you like to hear me talk about? http://marc.info/?l=nyphp-talk&m=133349601322378&w=2
 
user895378
1:00 AM
@ircmaxell What's the probability of getting said talk online in a video format?
 
Pretty good...
 
user895378
In that case, my personal preference is for the discussion of PHP's internals
 
user895378
1:20 AM
> if the file with declare was included then it does not affect the parent file
 
user895378
^ annoying
 
user895378
I have to actually remember to put that in the "main" file every time.
 
user895378
@ircmaxell Thanks for the heads up on that. My basic tests didn't pick it up because (as you predicted) declare(ticks = 1); was in the top-level file.
 
user895378
I'm sure there are low-level reasons for that behavior, but it still drives me nuts.
 
2:01 AM
:-D
 
Lee
2:40 AM
hello, my first time on chat.
 
 
2 hours later…
Lee
4:20 AM
could someone please explain the usage of ".=" statements in a PHP while-loop?
Google is not searching the ".=" part.
 
user895378
@Lee Can you post some code so we know what you're talking about?
 
Lee
for example in a MySQL Query of rows. I can't give you the code because I saw it a couple of times many months ago and I can't remember.
 
4:39 AM
@Lee It is concatenating strings. $foo = 'Hello'; $foo .= ' World'; echo $foo; would result in 'Hello World'
It would be the same as $foo = $foo . ' World';
 
Lee
4:54 AM
how would it be used in a MySQL query? Any benefits?
 
I most commonly see something like that used to conditionally add an 'AND/OR' statement on to the end of a where clause
But really it is just concatenating two strings...so pretty much anytime you're building a query where you wanna smoosh two parts together
 
Hi, does anyone see any problem with mixing a function signature with type hints with variable arguments:
public function buildView($className, $Writer /* Var Args */)
hmm, i guess I do now that I try to implement it. I'd need to use reflection to instantiate the view that I am building with variable arguments.
I think my problem is a fight between using a simple array as a Dependency Injection Container and only having single argument constructors, using type hinting and long constructor argument lists or creating an Dependency Injection Container object. Does anyone have thoughts on their preferred solution?
 
5:52 AM
mornings
 
yo
hows it goin teresko
 
6:09 AM
morning
 
hey paul
thanks again for that help on my DI question
whoever runs the twitter for codereview decided to tweet it haha i got a kick outta that
 
@AndyPerlitch hi, no problems, that was a good question. Its a pleasure answering clear well thought out questions with easy bullet points to follow. Nice, I should check out that twitter. They did pick a good question IMO.
 
yea i really try not to ask questions to readily on stackexchange... its hard not to but i do think its kind of insulting to people answering if its not well-thought out
i probably ask one too many questions here in chat though...
@Paul i definitely see this same dilemma... ive got some pretty long parameter lists on some constructors, all of different dependency objects
 
6:25 AM
people are free to ignore them here at least. The more annoying ones for me in chat are either the really vague questions, the please provide solution ones or how do I build a skyscraper.
@Andy Yes, I'm leaning towards a single associative array for setup parameters.
 
@Paul yep. i made that mistake once a while back and got (rightfully) bludgeoned for it. learned my lesson lol
@Paul at the expense of type hinting?
 
@AndyPerlitch I had the idea a week ago to change from that, but I think I am going back towards the associative array. Almost every object I use is built from a factory method. So, I don't get any benefit from the type hinting on the actual classes. Although I could still type hint my Factory methods I guess.
 
yea i was gonna say i think i made the decision to just have long constructors because i figured i should have factories doing the constructing anyway, and often having a ton of objects may be indicative that something else is wrong with my design
its a tough call, especially if you expect to be adding more objects to a constructor
which inevitably will happen
@Paul btw that arrayaccess interface is working like a charm, great tip. my config lookups are a lot cleaner and easier to read/write
 
One thing I don't like about parameter lists is that the order is important. I think I'll be going with an associative array for now. Thats cool, I'm glad the ArrayAccess is working well, I use it in a very similar class too. It even works for multi-level arrays which is cool.
 
yeh the order thing is definitely a caveat. i'll probably explore the associative array method for construction at some point. you are most likely doing more advanced stuff than i
 
6:41 AM
@AndyPerlitch I'm not sure on this one, I have a bad feeling that I could be doing things better.
 
@Paul i am all-too-familiar with this feeling...
but i suppose its what keeps programming fun
atleast sometimes
aight im out. catch ya later @Paul
 
bye @AndyPerlitch
 
7:08 AM
ya know ... when project manager tells you to fix some frontend bugs made by someone else, its normal thing .. but when he sends you a video and tells "make it act like this" it is a bad omen
 
7:27 AM
@alL hello
 
7:54 AM
1
Q: CSV generation Through Class giving result in just one Column

Teknords <?php /** * Zend_Controller_Action_Helper_Csv * * @package KA * @author Konrad Abmeier * @copyright Copyright (c) 2011 KA :: Konrad Abmeier (http://blog.abmeier.de) * @license http://creativecommons.org/licenses/by-nc-nd/3.0/de/ ...

hello all! kindly please look at this question and please answer it if possible i am making a small mistake and i dont know where its stackoverflow.com/questions/10013427/…
 
8:05 AM
anyone please
 
8:22 AM
Seriously... Zend Controller has helpers for CSV?
 
no its not of zend
 
I would just use implode and explode for it...
 
@Teknords it looks like the output is as I'd expect for CSV. It doesn't look like 1 column output to me.
@Teknords Import it with carriage returns for a new line and it should work
 
how ?
now its doing so fputcsv($fp, $aryLine, ';', '"');
 
well, actually perhaps it is the ; separator rather than , that is not working for you?
 
8:25 AM
all my data is comming in one column
let me change it sir
 
does doctype html switch to standard mode even if the browser doesnt support it?
 
@Yohann doctype html is for html 5 i believe.
 
yeah but does it fallback to standards mode when the browser doesnt support it?
 
i have no idea, sorry.
 
@Paul thanks anyways :D
 
8:29 AM
Heh, I like Perl where processing CSV file is as simple as process_line split /;/ while <>... but it's not that hard in PHP either...
 
8:55 AM
hi alll
can u please help with the a scenario
@Paul hi
 
9:12 AM
@Goofy what is your scenario?
 
@shiplumokaddim thanks
@shiplumokaddim i need code to send sms usiing php
@shiplumokaddim and also i need to know how it works
 
@Goofy basically there are SMS gateways. All Gateway has a protocol on which they listen and talk. All you have to do is just tell them to send sms in their protocol.
 
@shiplumokaddim please elaborate on that i am very new to php
sorry
@shiplumokaddim what are sms gateways
 
The problem is not all Gateway has same protocol. Some uses HTTP some uses Mail. And If you have a nokia phone connected to usb you need the hardware interface to it.
SMS gateways are gateways where you put the sms and it gets to the receiver
 
@shiplumokaddim one moment please
 
9:18 AM
@Goofy learn more on SMS-GateWay en.wikipedia.org/wiki/SMS_Gateway#Gateway_types
 
@shiplumokaddim dude i am really sorry i am not able to understand these ...can you please explain from scratch ...how should i go about this
 
@shiplumokaddim ok
 
@shiplumokaddim ok ok
@shiplumokaddim webdeveloper.com/forum/showthread.php?t=170285 please check this and tell me will it work
i also tried it but i dont have one file mentioned in that
sms_success.php
 
9:30 AM
hi
how can we validate space in a username textbox in yii php
 
what does "validate space" mean ?
 
validatiing a space..when we enter a space only in textbox it will not validate
@teresko hope u got the idea?
 
just trim the content , and check if it is empty
 
@teresko how can it be done in yii framework
 
$string = trim( $string );
 
9:40 AM
@teresko k..is it done in controller??
 
???
in yii there is function rules() where the validating rules are defined.
 
you dont even have the basic understand of what MVC is
 
can we modify that or any???
sorry
leave it man..any way thanks
 
 
1 hour later…
@RepWhoringPeeHaa Sometimes I wonder if users are actually reading what they post.
 
11:14 AM
@hakre It's just sad
 
user895378
> the javascript is not working ..
 
@rdlowrey If the horse is dead, it's time to jump out of the saddle. ;)
This ditaa is somewhat funny: goo.gl/tiqpC
 
whatever
 
@hakre that's an awesome tool
 
woah
 
@ircmaxell hum?
 
that tool
 
11:46 AM
Used it in this answer: stackoverflow.com/a/10025272/367456
Just some iterator playing again.
 
@hakre You are crazy.
 
seriously
 
(That's supposed to be a compliment :)
 
Thx ;) I need to understand MultipleIterator better because I smell it can be re-used here.
 
12:03 PM
Answered to that answer as well, with a simpler solution (based on the principle of merge sort)
@hakre: I'm confused by your merge class...
Ohhhh, I see what's happening now
0
A: php merge two or more ArrayIterators by one of their values

ircmaxellOk, this is fairly simple. Assuming both iterators are sorted, all you need to do is to do a merge sort on them (basically): function mergeIterators(Iterator $it1, Iterator $it2, $compare, $merge) { $result = array(); //rewind both itertators $it1->rewind(); $it2->rewind()...

 
posted on April 05, 2012 by Derick Rethans

Working at 10gen London, UK Thursday, April 5th 2012, 13:00 BST As of today I am working for 10gen, the company behind MongoDB. I have been contracting with them for a few months to work on the PHP driver for MongoDB. I am now making the switch to a full time position. I am responsible for supporting MongoDB in the PH

 
Does PHP support pointers/references to a function?
I want to do smth like this on PHP:
http://ideone.com/FwYAt
how could I code it in PHP?
the same by idea
 
12:19 PM
@ircmaxell Actually TS was asking how to do that iteratively so to not store everything again inside a new array - while your function follows the same algorithm I implemented inside an iterator with the difference that I don't limit the number of iterators and keep merging out of the iteration itself.
@user1131997 It's called "Callback" in PHP, you find it here: php.net/manual/en/language.types.callable.php and here: php.net/manual/en/…
 
@hakre I know, that it's callback, cause I code it in program you had seen uppper.
// Type 1: Simple callback
call_user_func('my_callback_function');

It's finished function
I want to emulate callback in PHP manually by myself
 
user895378
Are you talking about a lambda function?
 
so , does PHP support idea of references or pointers?
@rdlowrey no
@rdlowrey callback isn't lambda function
by its definition
 
user895378
Well, in PHP a lambda/Closure is a valid callback
 
@user1131997 I don't understand what you want. Do you want callbacks, or do you not want them?
 
@NikiC Does PHP support any reference-like mechanism?
 
morning
 
function () use (&$reference) {}?
 
@user1131997 Yes, PHP also has references, but not in the C meaning of the term
But references != pointers != callbacks
Especially I don't get what references have to do with callbacks
 
user895378
@CarrieKendall morning
 
12:27 PM
What in C is a reference to a function is in PHP just the function name in a string ;)
 
lamda must have such options:

- reduction
- currying

as for basic

Does callback have it?
 
@CarrieKendall morning
 
Morning all
 
@NikiC I know it, but it may be very closely to each other in implemantion of callback
 
@NIkiC: Well, technically PHP also has closures, but closures are technically objects and objects are always passed by reference...
 
12:29 PM
Ok
 
@user1131997 In C, yes, they are closely related. But in PHP they are not.
 
just simply help me
 
user895378
@user1131997 PHP's Closure implementation isn't strictly a lambda (I believe) as it carries scope ...
 
You never have to pass functions by reference. It's useless.
 
@GlitchMr Objects are not passed by reference, unless they are explicitly told to. Common misconception :)
@user1131997 I would love to, but I still don't really understand the question :(
 
12:30 PM
void A(void);

void(*ptr)(void) = &A;

What is the analog on PHP od these 2 lines?
thanks
 
@user1131997 function A() {} $ptr = 'A';
 
<?php
$a = new StdClass;
$a->blah = 1;
$b = $a;
$b->blah = 2;
var_dump($a->blah);
@NikiC, so why $a->blah is 2 and not 1?
 
So I can call

echo $ptr;

And that whill call A() function?
or what?
 
@user1131997 if you do $ptr(); it will call it
 
@NikiC ahhh!
@NikiC thanks a lot!
 
12:32 PM
$function = 'strlen'; echo $function('hallo'); => 5
 
@user1131997 You can use an array to describe a "pointer" to a member function too:
 
@Bracketworks How?
 
$function = function() {return 1;};
$alias = $function;
echo $alias(); #1
 
@Bracketworks Please, give me your simple! Thanks a lot!
 
class A{
    public function b(){}
}
$a = new A();
$ptr = array($a, 'b');
There we go. Now, $ptr can be passed to any function accepting a valid callback as a parameter type. (or callable on 5.4+)
 
12:33 PM
@user1131997 All those different callback forms are described here: php.net/manual/en/language.types.callable.php :)
 
@user1131997 I don't recommend just converting what you do in C straight into PHP.
 
Oh, right, I see the difference...
It's more like everything in object passed by reference, but not object itself...
 
@GlitchMr Yup. You can say that a handle to the pointer is passed by value :)
 
@Paul PHP already has a lot of goto; in its sources, bad design and a lot of memory leaks/corruption, so PHP isn't recommend recursively by itself :)
 
@user1131997 Agree on goto and bad design, but disagree on memory leaks/corruption :)
 
12:37 PM
@NikiC in build-news there are a lot: fixed possible memory corrpution in each build-report at PHP.net
 
PHP shouldn't have memory leaks, except the problem is that nearly everything is global.
And could be referenced before script will end, so PHP tries to avoid using garbage collector on those...
 
What does everyone have their right margin set to?
120 on NetBeans nightly here.
 
@user1131997 Out of interest, are you wanting to use a 'function pointer' in procedural or OO code?
 
not exactly PHP has it, but the VM of PHP , and earliler with calling some functions in PHP you may cause a lot of troubles in work of PHP-VM in OS, that may caused leaks, coruption etc

And at PHP.net there are a lot of obsolete function with warning "not to use" or , that was removed or redesigned
 
@user1131997 If you see lots of fixes for memory leaks in the NEWS file, that's okay. It doesn't mean there are many relevant leaks. They are all just edge case conditions that you don't hit in usual code. I fixed something like ten memory leaks for PHP 5.4.1 and I can definitely tell you that you'd have to work really hard to ever get at one of those.
 
12:42 PM
@Paul OOP is just procedural but in classes and pattern's design shell
Object-oriented programming (OOP) is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their interactions – to design applications and computer programs. Programming techniques may include features such as data abstraction, encapsulation, messaging, modularity, polymorphism, and inheritance. Many modern programming languages now support OOP, at least as an option. Overview Simple, non-OOP programs may be one "long" list of statements (or commands). More complex programs will often group smaller sections of these state...
 
Also, what PHP developers call a memory leak isn't actually a real memory leak. In PHP memory can only leak til the end of the request, after that all memory is freed regardless. There are no inter-request leaks
 
go to 7 Criticism at Wiki
you will see the right critism of OOP
the one of theoretic's fails of OOP , why in its features there is: polymorphism, but not isomorphism and another *morphism structure.
 
@hakre Ah... I got ya
@NikiC Not true. Any memory allocated with pmalloc or malloc will not be freed after the request
 
@ircmaxell Which is none :)
 
@hakre But that's what copy-on-write is for. The inner arrays won't duplicate, just the buckets
@NikiC none? extensions do it. The core does it (for certain things)
 
12:47 PM
Only external libraries use malloc()
and if an external lib leaks, that's not PHPs fault
 
but the core uses pmalloc
 
you mean pemalloc?
 
perhaps
 
yeah, sure, that's not cleaned up ^^ But it isn't supposed to ^^
 
@user1131997 I take it that it is procedural code you write, fair enough.
 
12:48 PM
Not arguing that @NikiC: just any leaks from pmalloc'ed memory won't be cleaned up
 
Heh.
nitpickers have to nitpick :P
 
@ircmaxell When you write (this needs always merging with default values), COW benefit won't kick in.
 
sure
@NikiC you should know that about me by now
 
@Paul is procedural style bad?
 
@ircmaxell :P
@ircmaxell Btw, when will you do the objects stuff?
 
12:51 PM
@user1131997 No, not at all.
 
@Paul opengl for example has procedural style
 
@user1131997 lol, no. In fact if you are wanting to use a function pointer I think it is better that you are writing procedural code.
 
possibly tonight
@user1131997 I would argue that yes, it is bad. Experience has shown it doesn't generate maintainable code, and tends to descend towards chaos in large projects. Instead, I'd choose OOP or Functional paradigms...
 
But it's good for quick n dirty :)
 
@ircmaxell you could separate it in diffrenet headers
@ircmaxell and present as pair class -> header
 
12:55 PM
@user1131997 huh?
 
@user1131997 You are a C programmer, right?
 
@NikiC Or just quick
 
and make separet compiling/interpreating
 
or just POC
 
like in opengl
 
12:56 PM
Then it's not procedural, but more of a hybrid between procedural and OOP...
which is fine.
 
@ircmaxell where it's OOP?
 
You can write OOP C...
 
@ircmaxell it doens't support 3 conditions of OOP, so how it could ba named as OOP-style?
@ircmaxell then it would be named C++
 
Not at all
you don't need an object to write OOP.
 
In absence of finally, should catch, clean-up, re-throw suffice?
 
12:58 PM
@ircmaxell where not at all?
 
Objects make it easier, but I've seen plenty of OOP code written in C. It's not as pretty, it's not as clean, but it can be done
 
@ircmaxell for OOP I need to support: data abstraction, encapsulation, polymorphism, and inheritance.
where did you see it in pure C ?
 
eih, I'm not going to argue
 
I can emuate RTTI in C, create struct with types and load it in memory for dynamic type identification, but it's not C feauture as classes and else
all can be emulated
 
If you look at the concepts of OOP, you can absolutely write C code that's object oriented. It's an approach to the problem. But I'm done, I have to go to work
later
 
1:01 PM
@ircmaxell I have looked, C doesn't support any feature of OOP
 
Bye @ircmaxell
 
@ircmaxell bye
@ircmaxell if you want to emulate or add support manually - that's another question, but pure C by its specification doesn't support OOP style at all
 
1:50 PM
What convention is commonly used to disambiguate a static method from it's member equivalent? Given an example; a class defines a static method, instances can invoke a method that calls the static passing this appropriately as context.
Obviously, they can't be named identically, but what's a good convention? Prepend "instance_" to the instance method (no, I don't like that, but you see where I'm going)
 
A good convention is to remove the static method :P
 
:-D
 
Yar har har :P
I've finalized the statics, as to prevent overriding, the instance methods can be overridden, but can access the statics to perform the "base" functionality.
 
2:12 PM
Have there been requests to fix ::__set() cannot take arguments by reference in the past?
I can't find any RFCs that mention it explicitly.
 
don't think so
 
Hmm, found an RFC, but it's quite detailed; it covers what appears to be a bit of an overhaul on the internals.
 
yeah? which one?
 
Bah, I misread -- it's just docs (summary info) on internals; the way some of it was worded appeared like a proposition.
(and I don't know enough about PHP internals, or C for that matter, to have recognized any code)
 
woot, finally got my IRC bouncer up
 
2:19 PM
^^
 
@Bracketworks lxr.php.net/xref/PHP_TRUNK/Zend/zend_object_handlers.c#159 <-- it's separating the zval, so no, you can't set it as a reference...
 
Hmm. Thanks @ircmaxell
 
interesting. Returning false from a setter will cause an error? That doesn't make sense...
 
@ircmaxell Doesn't seem to
 
@ircmaxell Surprised? :P
 
If it weren't discarded, where would it go?
 
the return code?
could be used to indicate an unsettable property
 
Now that is a feature that should be implemented.
If it were to return FAILURE (or whatever is appropriate) it would issue an error, thus rendering the property read-only?
 
2:43 PM
@Bracketworks Don't remember, but if you use only object types in your application, you don't need pass by reference.
 
@hakre Yea, unfortunately, wrapping scalars into objects is not very sugary.
$foo->bar = &$baz; would have been splendid, but alas.
 
@Bracketworks actually __set is not very sugary either.
 
@hakre How do you mean?
 
property names as strings are not really explicit.
I'd prefer an array then, so it's clear what it is.
 
Ah, as in $foo['bar'] = &$baz;?
 
2:47 PM
yes, but before you ask: no, it does not work as well with ArrayAccess setting the reference IIRC.
 
You sire (errata: 4/5/2012-10:48AM "sir"), are absolutely correct. :P
 
Please say sire. ;)
 
I know magic is "bad", but darn it, it makes for nice syntax when not abused.
Why can't the magic/indexers/operator-overloading work as expected... :(
 
@Bracketworks Well, it's magic...
 
lol, answers like that invariably lead to frustration :P
 
3:37 PM
Magic promises too much. Well, no news, we know this from reality, but well ;)
 
user895378
Context: I'm trying to create a no-static ActiveRecord implementation.
 
user895378
Question: If I have a domain model object, call it Entity, how do people feel about injecting Entity::__construct with a private EntityFactory instance that is strictly used to generate association objects?
 
@rdlowrey I actually had a very similar idea for the same basic principle. Personally, I liked the idea of it but I never got around to implementing it yet so not sure about the actuality versus the theory
 
user895378
@CharlesSprayberry Well, I've gotten to a point where it works nicely with that setup (very rough draft) ... but before I go further I just want to make sure people don't think it's a bad idea.
 
@rdlowrey I think it is a great idea for whatever that's worth. :)
 
user895378
4:30 PM
Thanks. It's completely testable, but my only concern is whether it would be preferable to force children of the abstract Entity class to inject specifically the association Entity classes they need instead of having the ability (from the abstract parent) to create any Entity on the fly ...
 
user895378
But the factory makes things wayyyyyyyyy simpler
 
4:46 PM
Yeah, it's for CSRF protection @RepWhoringPeeHaa
 
00:00 - 17:0017:00 - 00:00

« first day (537 days earlier)      last day (4423 days later) »