« first day (1118 days earlier)      last day (3846 days later) » 

2:00 PM
@NikiC no one in particular?? Confused?
 
@BenjaminGruenbaum Perl tends to polarize people. I subscribe to Larry Wall's view: the language is powerful and that leads to a great potential for misuse.
 
@bwoebi Most people on the list don't write from @php.net mails, so I wonder if you're talking about anyone in particular ^^
 
@NikiC well, I'm talking about people which have one such account, not peop
Le which write from another mail account...
But forget it; not important to waste time discussing about that....
 
@bwoebi yes :D
@bwoebi Also, you can't really expect people to know all of PHP ^^
 
2:04 PM
good morning
 
It's a big language. Not as big as C++, but still pretty large
 
@NikiC Also, there is no clear definition of "all of PHP" unless you have a spec I'm not aware of.
 
@NikiC so I've realized lack of sense in recursive generators (after playing a bit). I think recursion has nothing to do with generator - but can be relied with sequence generation function - and that's not the same
 
@Simon_eQ jo
 
@AlmaDo Does PHP has yield from or generator expressions?
 
2:06 PM
@AlmaDo There is a concept of recursion for generators, it's just different from normal recursion ;)
 
Anonymous
@PeeHaa omhoog
 
@NikiC so I've ended with splitting generation function and generator itself
I mean
0
A: Recursive generators in PHP

Alma DoThanks to Mark Baker I've realized that real use-case for this is hard to find (if not impossible). Generator is not a function, yes (may be that confused me) - so "calling" it inside with "recursive" parameter is near useless. We can act like Mark suggested, but after thinking a bit I've ended ...

 
@BenjaminGruenbaum no and no
 
@BenjaminGruenbaum what do you mean?
 
@NikiC Because you don't believe in that or because no one implemented it?
 
2:07 PM
you need to simulate yield from with a bit of custom code :)
 
@BenjaminGruenbaum Interesting take. :P
 
@AlmaDo yield from means "consume all the content of another generator and yield it before continuing with this one" - it's a nice way to work with generators. Generator expressions use a query-like language to create generators.
@AlmaDo if you haven't use Python before, now is a time to pick it up for another perspective as it does both well.
 
@BenjaminGruenbaum The perl documentation is shocking, I'll give him that point.
 
Anonymous
@PeeHaa Q: How does autoload deal with class constructors ?
 
@BenjaminGruenbaum Because I don't believe in providing a bad implementation for yield from, like Python did ;)
Implementing yield from properly is somewhat tricky :)
 
2:09 PM
@BenjaminGruenbaum not natively but you can emulate this
 
@NikiC So implementation, cool. C# doesn't have yield from either (and it's annoying) but JS has it. Really smart people worked on yield* (JS's yield from) and it's not implemented yet but it's spec'd
 
@BenjaminGruenbaum may be it's like:
function xemulate($count, callable $generator, $injector=null)
{
   if(isset($injector)  && get_class($injector)=='Generator')
   {
      foreach($injector as $value)
      {
         yield $value;
      }
   }
   for($i=0; $i<$count; $i++)
   {
      yield call_user_func_array($generator, [$i]);
   }
}
ugly, but idea is trivial
 
@AlmaDo I'm not a great PHP programmer but get_class smells bad here.
Also, you can yield from inside the generator, in the middle.
 
@BenjaminGruenbaum well, I'm not sure how to realize that $injector is generator in other way\
 
@AlmaDo @NikiC can you extend generators in PHP, or inherit from them?
 
2:14 PM
@BenjaminGruenbaum no, it's declared as final
 
@BenjaminGruenbaum github.com/nikic/ditaio/blob/master/lib/stackedCoroutine.php => This is my yield from implementation in userland PHP. You do the call to the generator with stackedCoroutine($generator) and can then use yield someOtherGenerator() inside it :) Also has support for return values via yield retval(123);
 
Hi
 
@NikiC Interesting :)
 
@BenjaminGruenbaum huh.. because.. 'just so'. I have no answer, it's how it is in PHP
 
2:17 PM
@AlmaDo Right, but you have the people who made it so in PHP right here in this room.
 
@Simon_eQ Not
It just loads a file. It doesn't create an instance
 
@AlmaDo so when I ask you why it's final I'm really expecting an answer from @NikiC
 
@BenjaminGruenbaum that's because I've said 'I have no answer' Unfortunately, I'm not PHP dev.
 
@BenjaminGruenbaum Mainly because you can't instantiate a Generator manually, so you will also not be able to instantiate your extended class, so it's all a bit pointless
 
2:18 PM
@BenjaminGruenbaum then ask him :p why ping me
 
@NikiC Can't you create an instance of generator, and feed it with a function?
 
@BenjaminGruenbaum no
 
morning
 
@NikiC btw, why not? I.e. why not have such way to define it?
hi, @CarrieKendall
 
2:24 PM
@AlmaDo Because if you need something like that, you most likely need an Iterator
a Generator is a kind of pre-defined Iterator anyway.
 
Fair enough. May be it should remain simple, after all
 
I must be overlooking something obvious here .. "/^[a-zA-Z0-9][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]{1}(\.[a-zA-Z]{2,})?$/" trying to match a domain name with or without a tld .. so "test" should match, but "test.com" should also match. Currently nothing matches.. i must be going insane ..
i'll make it shorter btw.. can be case insensitive
 
you can remove `{1}'
 
indeed.. added that when testing
 
2:28 PM
wont fix it though
 
also not sure about ? after () group
 
@DamienOvereem Matches for me.
How are you testing it?
 
must be something with html5 then. It's used as a "pattern" attribute in a form field
Results in "<input type="text" autofocus="" required="" pattern="/^[a-z0-9][a-z0-9-]{1,61}[a-z0-9](\.[a-z]{2,})?$/i">" currently
 
@MadaraUchiha how would you actually do that in PHP? stackoverflow.com/a/19838448/1348195
That is, what'd be the common practice, assuming repeating an ugly echo 3 times is not it.
(Talking about stackoverflow.com/a/19838448/1348195 of course)
 
@BenjaminGruenbaum I wouldn't submit to the same page.
And also, I wouldn't use PHP but JavaScript (probably localStorage)
 
2:33 PM
Ah crap.. i got it. In the pattern attribute in html you have to omit the seperators
 
@MadaraUchiha Right, but if you did do it in PHP (had to submit to the same page, or at least to a page containing the same form) and you didn't want to use JS - what would you do?
 
guess /i is out of the question too then
 
@BenjaminGruenbaum Probably a template abstraction or something similar.
 
@DamienOvereem how so? i.e. no modifiers?
 
@MadaraUchiha Superglobals in php make me want to cry :P
 
2:34 PM
Looks like it pattern="/^[a-z0-9][a-z0-9-]{1,61}[a-z0-9](\.[a-z]{2,})?$/i" fails, but pattern="^[a-z0-9][a-z0-9-]{1,61}[a-z0-9](\.[a-z]{2,})?$" works
 
@BenjaminGruenbaum Put the options in an array and use a loop? :)
 
If I couldn't deploy a template class or some sort of controllers for some reason, that's how I'd do it (probably not with $_REQUEST though, $_POST or something)
@NikiC And if not all fields were filled?
 
@MadaraUchiha what does that change?
 
I always feel angle bracket syntax is so verbose
 
@NikiC Unfilled inputs are not submitted, not submitted values won't show up in your loop
Unless you have something different than me in mind.
 
2:37 PM
@MadaraUchiha then define full possible fields set in script and that's it
 
@MadaraUchiha looping on the enum values probably.
 
@MadaraUchiha maybe I don't understand the problem then
 
Yeah, guess it also works.
I haven't mixed logic and presentation in a while, so I'm a little rusty on that front.
 
I haven't written a <form> in a while, so I'm a little rusty on that front too :D
 
so do I
 
2:38 PM
@MadaraUchiha thx for leading me to the implementation ;p Never occurred to me that html5 patterns can't deal with seperators/modifiers
 
@NikiC you're lucky :p
 
Forms + html5 are awesome though.. saves so much time on the javascript department ..
 
4
Q: How can I configure PHP to ignore error_reporting() at runtime?

tomwrongI am running an application which is riddled with error_reporting calls, but I'm running PHP 5.5 which has a lot of depreciated warnings. I have configured my php.ini file correctly like this. error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT But all of the error_reporting() calls override i...

uuuuuuuhhhhhhhh
 
ummm... ok
 
Yes, I also fix my warnings by disabling error reporting!
 
2:41 PM
which is why the "warning system" is broken at a fundamental level
 
cool story..
 
@ircmaxell so, how was yesterday? :)
 
tomwrong is obviously wrong.
 
who was the guy who thought echoing errors/warnings to the screen was correct behavior at any time anyway?
 
Right. So rather than fixing the problem, you can monkey patch around it... Sounds brilliant! Oh, wait. No. Other way around. Sounds silly. Instead, why not just freaking fix the errors that are thrown? That sounds sensible... — ircmaxell 8 secs ago
 
2:42 PM
well, if time="debug" - I think it's ok
 
@NikiC very good. You would have had a good time
luckily, I am here until Sunday morning ;-)
 
@ircmaxell Because that's the software he's using (vBulletin 5), he probably has no choice.
> I don't want to mention the name of the app, it's VBulletin 5.
 
It was mostly directed at the commenter above me who wrote:
It would be nice if you could "force" redefine a function. like you can do in JavaScript. Oh well. — tomwrong Oct 25 at 12:50
 
yeah .. define(true, false);
 
2:45 PM
@ircmaxell I really miss your PwA videos though :(
NEEDS MOAR
 
I know, I need to get "inspired"
 
We can hook you up.
 
have to go. see you guys
 
@webarto * and +1 for the "magic file..." comment :-P
 
:P
 
2:48 PM
lol
 
I love how my blog's traffic has been increasing over time, even though I've been posting less and less
 
@MadaraUchiha you seem to have upset someone: stackoverflow.com/a/19829349/1443490
 
also, I do need to do another PwA video, or three
 
@cheesemacfly Meh, the colonel gets upset because it's tuesday, because it rains, because someone mentioned that mysql_* is evil.
 
@MadaraUchiha haha, I know. Funny how this question has been a trouble source
 
2:53 PM
@ircmaxell Fun fact - you can't actually do that in JavaScript.
 
@creesemacfly .. i guess that big wall of text falls in the "not an answer" category.
 
Please help: If it says tried to allocate 32 bytes and crashed. Does that mean only 32 bytes or more?
 
@BenjaminGruenbaum explain...?
@webarto 32 more bytes
 
@DamienOvereem yep...
 
@Ocramius damn your Doctrine! :P @ircmaxell thank you!
 
2:55 PM
@ircmaxell You can't force a redefine on all functions. Someone can freeze a function which means you won't be able to redefine it, moreover - you can't redefine a lot of the built ins in modern JavaScript to prevent abuse that was prevalent in the past.
You can override most things, but saying you can redefine everything is just wrong.
 
@BenjaminGruenbaum well, fair enough
the truth lies in the middle. The concept of the quote wasn't wrong, the totality of it was
 
Why in gods name is his other answer locked though o.o
 
that's page-views on my blog, per month
 
@DamienOvereem Because of the rollbacks he kept doing
 
Ah right,. what a mess ..
 
2:57 PM
@ircmaxell Sorry for directing at you, but mem limit is 1GB, is that "shared memory" for all requests or per request? Server has 64G and half of that users.
 
yeah...I still wonder how he got 2 upvotes on his second answer tho
 
@webarto PHP mem limit? That's per request
 
@ircmaxell He asked for a feature that people don't/shouldn't use in JS in PHP - when that feature doesn't really exist in the way he wants in JS either.
 
but when you say "crash"?
If you weren't so rude, I'd explain. — tomwrong 2 mins ago
 
@cheesemacfly His ego upvoted him twice.
 
2:58 PM
that might be it :)
 
PHP Fatal error:  Allowed memory size of 1073741824 bytes exhausted (tried to allocate 32 bytes) in /doctrine/Doctrine/Connection/Statement.php on line 257
@ircmaxell
 
@webarto that's a single process that's using a full GB, trying to allocate 32 more bytes
 
@ircmaxell Thank you very much. All clear.
 
@ircmaxell How does that happen? :o
 
Possible because DB has millions of records and many relations, Doctrine is going nuts.
 
3:00 PM
@MadaraUchiha trying to allocate more bytes ;-)
 
Short of uploading a 1GB file into a variable, how do you get to 1GB? :o
 
@MadaraUchiha ummm, making a lot of variables (deep arrays, wide arrays, etc)
 
@webarto Then perhaps Doctrine isn't the tool for the job :P
 
It has 64GB and 32 users online...
 
still doesn't understand why the default is printing errors/warnings to the screen
 
3:00 PM
@ircmaxell but a GB?!
@BenjaminGruenbaum What would you have it do?
 
@MadaraUchiha I think you missed the "Doctrine" bit
 
50 secs ago, by webarto
Possible because DB has millions of records and many relations, Doctrine is going nuts.
 
(Of course, printing it in the middle of the rest of the output sucks :P)
38 secs ago, by Madara Uchiha
@webarto Then perhaps Doctrine isn't the tool for the job :P
 
If you're using an ORM you should be expecting maximum possible inefficiency :)
 
The thing is, on dev it was 50% faster than it was before (with some optimizations), and production is crashing :)
 
3:02 PM
OH: ...
 
@MadaraUchiha Not print errors warnings to the screen. Return a 500 error which contains a stack trace and all relevant information on staging. Return a blank 500 error in production. Break into debugger if a debugger is attached.
 
@ircmaxell Blog about it :P
 
@BenjaminGruenbaum isn't that exactly what it does?
ah wait, you probably mean non-fatal errors too
nevermind then
 
...
Also, stack traces, and break into debugger.
Also, not print out the error to the user ever.
User of the system should not be aware or be exposed to internal implementation when possible.
 
3:05 PM
That's how it should be done, but it's not enforced...
You have all options to do that by yourself, easily.
 
For starters - it should be default.
Including the debugger part, and the staging production separation.
(and the stack trace)
 
That sounds more of a "framework" to me, tbh.
 
@webarto no, I meant that I should quote @NikiC on twitter as saying "If you're using an ORM you should be expecting maximum possible inefficiency"
 
@webarto What does that have to do with a framework?
 
@ircmaxell Ah :) My ass is on fire, didn't get it.
 
3:07 PM
:-P
 
I'm still waiting for an ORM that JITs
I think that could be awesome.
 
good luck with that :-P
 
@ircmaxell Hehe, I'm not saying it's very practical - just that I see a lot of potential in an ORM that optimizes queries. It's more practical in languages where functions are mapped to queries instead of strings so you get an AST.
 
:-P
 
@Simon_eQ That top answer is so simplistically wrong.
You could do those same vulnerabilities in ANY dynamic language.
The only one with any weight is the XSS example.
 
Anonymous
3:16 PM
> A high level scripting language that introduces goto in version 5.3 is just wrong.
 
Anonymous
I don't understand that one though
 
Does somebody know of a â–´ character only facing to the right?
â–˛
 
Like a bullet point?
 
Anonymous
&#9664;
 
Anonymous
â—€
 
@ircmaxell You have powers on that Twitter, I keep getting mails constantly.
 
well, it is awesome!
 
Anonymous
Geometric Shapes is a Unicode block of 96 symbols at codepoint range U+25A0-25FF. U+25A0-U+25CF {| class="wikitable" style="text-align: center; vertical-align: middle; font-size:85%; empty-cells: show; border-collapse: collapse; border: 3px solid; padding: 2px;" |- ! colspan="2" width="31%" style="border: 3px solid; padding: 2px;" | 25A0|| colspan="2" width="31%" style="border: 3px solid; padding: 2px;" | 25B0|| colspan="2" width="31%" style="border: 3px solid; padding: 2px;" | 25C0|| width="0*" style="border: 3px solid; padding: 2px;" |   |- style="font-size: 75%;" ! wid...
 
> I would in fact prefer, instead of <h1>, <h2> etc for headings [those come from the AAP DTD] to have a nestable <section>..</section> element, and a generic <h>..</h> which at any level within the sections would produce the required level of heading. -- Tim Berners-Lee, October 1991
 
3:25 PM
@DanLugg yes...
 
Anonymous
Why are interfaces so useful in PHP, when in-fact all they do is enforce class to implement methods declared in that interface.
 
Whoever kiboshed that, I'd like to beat with a hot iron.
 
Anonymous
I just don't see the difference b/n abstract classes/traits/interfaces
 
@simon_eq a class can use multiple traits, but can only extend 1 abstract
 
@Simon_eQ an interface and an abstract class with only abstract methods are very similar in implementation
they are different on a conceptual level though
brb
An interface indicates something that your class does, a contract it signs, if you may.
 
Anonymous
3:28 PM
@DamienOvereem Yeah, I knew that. But, I just don't understand why interfaces are the most important of the three objects..
 
@Simon_eQ Traits are just run-time copy-paste; that would contribute to their lesser importance.
 
For example, you implement an interface Mapper on a class
On the object/method/function requiring it, you can type-hint function test(Mapper $mapper)
 
I wish JS would enforce no setters on prototype objects.
 
@MadaraUchiha tnx
 
Now, you can safely call any method defined in the Mapper interface, without worrying about specific implementation.
@PeeHaa yw
 
3:30 PM
interfaces basically allow expectations.
 
Yes
@Simon_eQ, abstract classes (and inheritance, in general), indicate a is-a relationship.
MainController extends Controller indicates that MainController is a Controller.
Implementation wise, they are similar, but OOP is not at all about implementation, it's usually more about concepts.
 
Anonymous
Sep 5 at 16:01, by igorw
@Simon_eQ interfaces are everything. most important part of OOP imo.
 
Anonymous
I just don't get it how ??
 
Anonymous
Ok, they enforce implementations, but how are interfaces the most important part of OOP
 
@Simon_eQ Because your classes should most heavily depend on interfaces.
 
Anonymous
3:34 PM
There must be something I am missing
 
@Simon_eQ When coding, what are your challenges? What are the tricky parts about code that are not hard algorithms and such?
 
Anonymous
@MadaraUchiha What if all my classes do not share anything, or aren't alike with eachother?
 
It allows you to focus on your layers, without focusing on implementation of lower layers too soon.
@Simon_eQ Then you are not programming OOP.
 
@Simon_eQ IMO, it's how different pieces of code interact. Does this piece require that piece? Do these work well together? What does this piece use? How do I use that piece?
@Simon_eQ interfaces define exactly that, how components interact.
 
You may be using classes and objects, but OOP without dependencies is not OOP.
@BenjaminGruenbaum Please take over, I need to take the bitch for a walk
Bitches love walks :)
 
3:36 PM
@MadaraUchiha not much point though, interfaces are pretty much impossible to explain to anyone who hasn't worked on a large scale project
 
Anonymous
I recently build a small Q/A site. It had like 5 classes for validating inputs, making query, handling emails, better session handling, password encrypting.. I wanted to create abstract classes, traits and interfaces, but I did not find any good use for those.
 
Anonymous
I wanted to use them, so just I could get to learn more about them by doing that, but it seems ... they are not used maybe for small-scale project...
 
Eh, there's still value in interfaces for small-scale projects
 
@Simon_eQ That's because you didn't need them. Too much abstraction can be a horrible thing. Interfaces work best when you work on code with other people.
 
Anonymous
@cspray That is my point too. But, none of the classes needed anything to be shared in-between, so making any effort to create an interface useless .
 
3:39 PM
@cspray Yes, but not nearly as much. Bad coding practices can still produce a working product and do so faster in small scale projects. You can put all the DB logic in the page in PHP and that'd still work well for a really small project.
 
Anonymous
@BenjaminGruenbaum bingo! Now that makes sense.
 
Anonymous
It should've been described as such in the manual
 
@BenjaminGruenbaum Sure, but all too often those projects become more than what they were intended
And then you have this system that's poorly built and can't be maintained at all.
 
@cspray Right, which is why modern coding methodologies focus on refactoring. Instead of creating a grand architecture for a 5 page Q/A site you code it simply, but knowing it might grow.
 
@Simon_eQ did that application have a login mechanism?
 
3:41 PM
Does anything look wrong with this statement:
    $query = "INSERT INTO alerts (subject, message) VALUES ($subject, $message)"; // Everything else will be inserted as the default value
    $sth = $this->db->prepare($query);
    $sth->execute();
 
Anonymous
@Kneel-Before-ZOD Yea, including register, password reset ...
 
It's perfectly possible to extract interfaces later on.
 
Given that there is a table named "alerts" that contains columns "id", "subject" and "message" ?
 
Eh, I don't think using an interface is really "creating a grand architecture". But, oh well
 
@AGirlSaidMySmileIsCute Along with injection.
 
3:42 PM
@webarto wut?
 
@Simon_eQ did you hardcode the db request into the class because you assumed you would only need a database for the login?
 
Anonymous
@Kneel-Before-ZOD No. I injected the settings through the constructor of the query class.
 
the login could have verified the provided data against a web service, a file, or a database; an interface would have allowed you the possibility of changing the data source at a whim
@Simon_eQ yeah....but it still relied on a specific class
as opposed to a set of operations needed
 
come on, anyone please?
 
3:47 PM
@AGirlSaidMySmileIsCute the values need to be wrapped in single quotes
since they are strings
 
I tried that.
 
@AGirlSaidMySmileIsCuteWhat webarto is saying is that you are using prepared statements the wrong way.. you do prepare query, but you do not use ->bind to actually assign your variables like you should
This way you still have sql injection possibilities
 
@cspray I was being general here. You don't always need interfaces.
 
your values should be VALUES (?, ?) .. and you should use $this->db->bind to assign variables to those ?'s
 
if you are preparing a statement, you need parameters
 
Anonymous
3:48 PM
@Kneel-Before-ZOD No, either I don't understand what you said, or it does not make sense. I can't see how creating a login interface helps improve anything, in a group of classes where only one deals with login task
 
oh nvm. you ment the sql statement, my bad
 
@cspray if you had to create a simple personal home page (pun intended) which needed very simple server-side functionality (mailing a contact form or putting what the user entered in a DB) would you use an interface?
@cspray There is no way I'd use an interface for that. Worse, I might even do it by submitting the form to the same page and putting the code inline. Still, it would take me a fraction of the time and it'd be trivial to re-factor.
 
@AGirlSaidMySmileIsCute anyway, just so you know, your use of prepared statements doesn't have a sense whatsoever since they are not 'prepared' in a sense that they are not 'binded, or something'
 
@DamienOvereem Oh right, that's a good point. I have that in rest of my code but not in this particular block of code. Thanks :)
 
@Simon_eQ think of it along this line: suppose the validated data needs to be validated against a db, file, web service or any other future data source, how would you build the mechanism such that you don't have to depend on a specific class/ data source?
 
3:51 PM
No need to astronaut architect everything. There is a big difference between talking about best practices and solving actual problems in the real world. No one likes to say it but there is.
@Kneel-Before-ZOD Why would you care if depends on a specific class/ data source if it in fact does?
 
@AGirlSaidMySmileIsCute it's not inserting?
 
0
Q: When to redeclare class property in inheritance for stricter more explicit type defining

DavidStraight to the point. abstract class AbstractRepository { private $mapper; public function __construct(AbstractMapper $mapper) { $this->mapper = $mapper; } } class UserRepository extends AbstractRepository { private $userMapper; public function __construct(User...

 
It's trivial to change it to depend on an interface later, if the need arises if you code it correctly.
 
@iroegbu No, it isn't inserting. That is the part that is confusing me.
 
@BenjaminGruenbaum and if you need to change the source at a moment's notice? you'd have to modify the validating class to accept the new data source
 
3:53 PM
@AGirlSaidMySmileIsCute no sql errors or something?
 
@AGirlSaidMySmileIsCute wait... you want to write code that doesn't work? :s
 
@Kneel-Before-ZOD It's naive to think you wouldn't have to change anything, and I've never had to change the source at a moment's notice ever.
 
@AGirlSaidMySmileIsCute it's not inserting because the variables should be wrapped in single quotes
 
@reikyoushin Nope. Nothing. It just refuses to insert.
 
@Kneel-Before-ZOD If I did, I'm not sure an interface would help, that's not the problem it solves at all.
 
Anonymous
3:54 PM
@Kneel-Before-ZOD sounds like you'r talking about factory/builder design pattern. The validatorClass does what is is supposed to do, accept an argument, validate it, and return data. the QueryClass does the same thing, takes argument and validates again the database. So, two different things here.
 
@Kneel-Before-ZOD I have updated them.
       try {
            $query = "INSERT INTO alerts (subject, message) VALUES (?, ?)"; // Everything else will be inserted as the default value
            $sth = $this->db->prepare($query);
			$sth->bindParam(1, $subject);
			$sth->bindParam(2, $message);
            $sth->execute();
        } catch (Exception $e) {
            header('Location: /404');
        }
Did the trick.
 
@AGirlSaidMySmileIsCute if you try your query directly on the database, will it insert?
 
@BenjaminGruenbaum If the only thing I was doing was inserting form values into a DB, perhaps not. But, I haven't really encountered many projects where that is the only thing you need to do. I also don't think it is that much more time intensive to think about the API that you want to use and create interface(s) for it. I certainly wouldn't consider it astronaut architecting.
 
@AGirlSaidMySmileIsCute $query = "INSERT INTO alerts (subject, message) VALUES ('?',' ?')"; // Everything else will be
 
@BenjaminGruenbaum doesn't an interface allows you to depend on a set of specific actions, regardless of who carries it out?
 
3:56 PM
@cspray That's because the good developers don't get the uninteresting projects. I don't get to do many "only insert form values to a db" either but when I do I don't create interfaces. Most projects just need that though.
 
@AGirlSaidMySmileIsCute ah so it's working now. good.
 
@reikyoushin Yup! :)
 
@reikyoushin no single quotes needed when using parameters
 
@Kneel-Before-ZOD hmm.. didn't notice that. but it will work either way right? ^_^
 
@Kneel-Before-ZOD No, polymorphism does that, you can do that with inheritance too for example. An interface your program defines and an interface delcared with the keyword are different :) That said what you said is mostly right and when you want to do polymorphic invocation correctly you usually want interfaces. The point though was sometimes not abstracting the "who carries it out" part is easier and doesn't impact the result.
 
3:57 PM
@AGirlSaidMySmileIsCute why you no use named placeholders? /:|
 
@reikyoushin I haven't used it with the single quotes before; maybe it might work :)
 
@iroegbu What do you mean? like :subject instead of ? ?
 
Well, I do see why sometimes interfaces might not be crucial. Of course I tend to implement most of my PHP projects/libraries using interfaces as the foundation.
 
@AGirlSaidMySmileIsCute yes
 
3:59 PM
@BenjaminGruenbaum And that's why I don't like it. Because ultimately you do have to solve that problem with inheritance and I strongly dislike inheritance :P
 
@iroegbu Ahh, I'll add it later.
 
@AGirlSaidMySmileIsCute The Location header value should be an absolute URI
 
@BenjaminGruenbaum that is true.......but I think that even on a sufficiently small project, if you look hard enough, you can still use interfaces somewhere, especially if it's an application that will be extended
 
@cspray I don't think I used solid (read: not abstract) inheritance in the past year or so.
 
3:59 PM
Hi there, I'm trying to install the GAPI for google analytics integration. I'm trying to add it to an existing table to tell me the Source/Medium for that transaction, however it is only returning 1 type of Source/Medium (which appears to be the top result for ALL over all time).
My code is like this:
 
I hope I won't regret having answered Derick's mail on internals…
 
$gapi_filter2 = 'transactionID == '.$order_num.'';
echo $gapi_filter2;

$ga2->requestReportData($ga_profile_id,$gapi_dimensions2,$gapi_metrics2,$gapi_sort_metric2,$gapi_filter2,$gapi_start_date,$gapi_end_date,$gapi_start_index2, $gapi_max_results2);

foreach($ga2->getResults() as $gapi_result2){
$ga2_sources = $gapi_result2->getSourceMedium();
}
 
@Kneel-Before-ZOD Yeah, but in practice most applications are uninteresting, are not extended and use trivial logic.
 
$orders[$cur]['Source']=$ga2_sources;
 

« first day (1118 days earlier)      last day (3846 days later) »