« first day (1243 days earlier)      last day (3720 days later) » 

12:00 AM
@Jack : dangerous in what sense? sql injection? or some other reason?
 
$placeHolders = str_pad('?', count($barcodes) * 2 - 1, ',?');
$sql = 'SELECT * FROM `inventory` WHERE `product_barcode` IN (' . $placeHolders .')';
Then prepare that statement and pass the array of barcodes.
Btw, consider making it a habit of giving arrays a plural name, an array called $barcode is confusing ;-)
 
If I were a tech recruiter, I'd probably look for who was bitching during that @GitHub outage. Those are the people doing OSS.
 
@JoeWatkins Pff! Git is meant for offline work heh
 
@Jack : thanks!.. bdw is it a good practice to run any query within a loop. whether while or foreach..
?
 
12:23 AM
queries in loops? sometimes it can't be avoided i suppose, but i wouldn't go as far as calling it a good practice per se.
 
@Jack : the code i posted.. how can i make it better? other than the prepared statement...
 
12:36 AM
@nick You could use a subquery ... WHERE product_barcode IN (SELECT product_barcode FROM ...)
 
@Jack hmm..
 
1:17 AM
0
Q: CSS not working in PHP

jhillkhuranaHere's my PHP <?php /** * Make sure you started your'e sessions! * You need to include su.inc.php to make SimpleUsers Work * After that, create an instance of SimpleUsers and your'e all set! */ session_start(); require_once(dirname(__FILE__)."/simpleusers/su.inc...

Love that title ^^
 
Does PHP do caches for dispatch? @NikiC @bwoebi
@JoeWatkins You might know that too ^
I've only peeked at how PHP does things internally; too many projects on my plate all the time ^^
To clarify: caches for method dispatch.
 
@LeviMorrison You mean for function calls?
 
Specifically method calls.
 
It uses caching structures for function calls afaict.
The other guys will probably be able to tell you whether any other optimizations are done for oo.
Office time~ cya!
 
1:32 AM
-1
Q: Fatal error: Call to undefined function password_hash()

user3217296Here's my error: Fatal error: Call to undefined function password_hash() in /Applications/mampstack-5.4.25-1/apache2/htdocs/php-login/application/models/login_model.php on line 462 PHP line 462: $user_password_hash = password_hash($_POST['user_password_new'], PASSWORD_DEFAULT, array('cost' =

 
grmbl
anyone got an internal PHP class that I can test against and that has a method with a default param?
something spl-ish if possible (want to avoid using pecl in travis)
 
@Ocramius Phar constructor?
 
hmm, no, can't use constructors :(
there's plenty of those
I tried PDO, but PDO is meh :P
Looking for something like php.net/manual/en/pdo.quote.php
oh, nvm
Phar#compress() will do
 
@ircmaxell Does PHP do any caching for method dispatch?
 
define caching
the call slot does have a cache
fci or something like that
fcc
 
1:47 AM
So a typical, naive method lookup basically walks up the inheritance list searching for the method to call.
On subsequent calls to the same method, is it cached locally somehow?
 
no, not like that
I don't remember, I know there's a FCI (function call info) variable, and a FCC (function call cache), which does save part of the lookup, but I don't think it's just for methods on an instance or ce, but instead for a particular call in code (opcode)
 
@ircmaxell You took that photo?
 
like 75 minutes ago
 
Nice. Is the 'Glass' because you shot it with Google Glass?
 
no, I shot it with a Canon 6D. It's called glass because the water looks like glass ;-)
 
1:54 AM
Oh, ok
I thought that looked insanely detailed for that :P
 
still not happy, will need to do some more shooting like that
 
There are some nice landscape shots around where I live I wish I could get that detailed
The phone camera just doesn't do it justice
 
that's my plan :-)
 
@ircmaxell My 2c - city skyline shots may turn out best when there's still some light in the sky to make the photo have a bit more going on in it.
 
@Danack I want the longer exposure that darker skys afford me
I just need to remember to turn off IS next time :-)
 
2:08 AM
@ircmaxell Yeah, you can still get a nice long exposure by using a smaller aperture - f/4 is quite open for a landscape shot. And it doesn't need to be much light in the sky, just a tiny bit to make the sky not be pitch black, and to give a tiny bit of illumination to the buildings - flickr.com/photos/danack/4236309303/in/set-72157623004022169 or flickr.com/photos/danack/6294923046/in/set-72157627830413610
(and yes, I subscribe to HDR the night shots school of thought)
 
as far as f/4, I was shooting everything from f/4 to f/11, using a VND filter for most of them...
@Danack #2 is beautiful
how do you like the 100-400/4-5.6L? I'm debating between that and the 70-200/4 IS L
 
2:26 AM
@ircmaxell Thanks. If you're going on a safari to africa, then the 100-400 lens is the perfect lens. Otherwise it isn't. It's not terrible but it's quite heavy, not as good for birding as the 400, and doesn't quite match the image quality of newer lenses. I don't regret buying mine, but it's definitely not a lens for everyone.
The 70-200/4 is meant to be amazing. I haven't used one, but have thought about it heavily.
 
Fair. The 70-200/4 is half the price and half the weight...
A friend has the 70-200/2.8, and is epic, just heavy as sin...
 
Yep. That's why I recommended prime lenses before - they're really not as flexible as zoom lenses, but they have the quality for a fraction of the weight - and the camera and lens you have with you, always takes a better picture than the one you left at home because it's too heavy.
 
Well, my nex is my every day camera. So weight matters, but not super much...
 
 
2 hours later…
m59
5:11 AM
Can an object commit suicide?
class Foo {
	public function suicide() {
		$this = null;
	}
}
$Foo = new Foo();
$Foo->suicide();  //$Foo === null
That isn't it, of course.
 
unset($Foo);
 
moorningsh
 
m59
@Jack yeah, from what I'm reading it can't actually null itself. The thought popped into my head and I got curious.
 
5:32 AM
0
Q: What is the difference between socket php functions

Dmitry FucintvWhat is the difference between the the two following functions: $fp = fsockopen("mydomain.com", 80); and $fp=socket_create(AF_INET,SOCK_STREAM,0); socket_bind($fp, "mydomain.com", 80);

Ehh, they do different things? =S
 
m59
public function workIt()
class AND swag.
 
Jes
6:06 AM
hi friends
good morning
 
m59
hello
 
Jes
@m59 thanks you are there
 
m59
I'm about to sleep.
What's up?
 
Jes
as usual problem coding
i got a form with checkbox and an input field next to each checkbox. i can enter a description and check the box right next to it. how to get all the checked box values and its description in a form
var services = $(" #services input:checkbox:checked").map(function(){
return $(this).val();
}).get();
console.log('selected services:'+services);
i did this to get the checked values
 
@m59 haha .. it's a trap!
 
m59
6:21 AM
!!google jquery checkbox values
 
m59
@Jes ^
 
Jes
i already got the checked values but need to get the values of input fields right to each checkbox
should i have a common id or somthing
 
@Jes Within the .map() you need find the next sibling, probably using $(this).next().text() or sth.
 
Jes
@Jack let me look into that
thanks @m59 @Jack @CapricaSix
 
6:43 AM
0
Q: issue with this and return keyword

user3292058I am very confuse with "this,return,echo" keywords in php classes. somebody please help me with simple example(s). And what is difference between echo and return w.r.t "this" keyword and also their behave. (also return true and false).

WAT
 
I'm confused about cow, politics and radio button ... please halps!
 
@Jack its easy. politics is the art of pushing a radio button to make people follow like cows
 
m59
@AlmaDo lol the php.net link
 
@m59 garbage in - garbage out
 
6:55 AM
@Gordon That explains it, I thought that politics is knowing when a cow should push a radio button.
Hmm, is there a functional paradigm for something like this?
I remember seeing it before somewhere ...
 
m59
7:10 AM
Does anyone ever extend a class just to make its name more generic?
 
Normally you extend to make it more specific :)
 
> Without a single doubt you cannot write software for something you do not uderstand ....
 
m59
SomeClass extends ThisClassHasSomeSeriousName
 
how come I live in world where this needs pointing out to programmers !?
 
@JoeWatkins I don't uderstand ;-)
Proper spelling doesn't seem to bother anyone on reddit, though ^.^
 
7:13 AM
woops
 
m59
@Jack well, I had a really generically named PDO wrapper called Db. For the sake of reusability, I took it out of my main project and made it it's own git repo and now I'm going to put it back in the project as a submodule. It's now called NicePDO which ruined its usage in my app.
I was thinking of doing class Db extends NicePDO { } and problem solved.
 
Morning.
 
hi, @Leri @JoeWatkins
 
@m59 You extend PDO for that?
 
but you actually do though, you're a pretty good example of how easy it is to become familiar enough to be useful .... you just can't debug software you don't get, what happens when you have to debug a frame outside the layer you understand, there's no shortcuts here, and no needs for shortcuts to be forced into existence either ...
 
m59
7:14 AM
@Jack, yes NicePDO extends PDO.
 
moinz all by the way ... I walked in ranting, sorry about that :D
 
For what purpose? @m59
 
m59
Just to reduce some redundant code.
 
Such as? What would be inside NicePDO ?
 
@m59 Is not PDO nice enough? :)
 
7:16 AM
class MySuperDBClass extends PDO implements KitchenSink;
 
m59
It's mostly just one smart function that does everything related to my typical usages. It prepares statements if I pass in parameters and returns the right data based on the query (stuff like fetch, fetchAll, lastInsertId, rowCount)
That's not the first time someone suggested it was silly, but I'm still surprised that everyone wouldn't want that.
 
I'm always a little confused when I read about people writing PDO wrappers ... PDO is the wrapper ....
writing wrappers for wrappers for wrappers that wrap stuff ... doesn't seem like a clever plan ...
 
m59
Sure, but why write several extra lines of code repeatedly?
 
@JoeWatkins Yeah, there are no shortcuts in finding out how certain parts of the system work .. you just have to dig in and call for help if you can't climb back out :)
@m59 Example, what super smart function do you have?
 
@JoeWatkins Wrappers are okay, however, extending pdo is pointless.
 
m59
7:20 AM
@Leri originally, it didn't extend it, but I got the impression that would be better, since, you can then still naturally use the native PDO stuff.
 
yeah wrappers are fine, so long as there's no near-infinite regress, which there tends to be :D
 
You extend PDO if you still need to pass your object into functions that only expect PDO ... but you could just as well do composition and pass the pdo instance when needed.
Oh, Amazon AWS introduced PFS on their load balancers :D
 
m59
@Jack overlook the silly name, kindly. github.com/m59peacemaker/PHP-NicePDO/blob/master/…
and be nice, I'm a noob.
 
hehe you called it workIt()? cute!
 
m59
well, exec and execute are taken lol
 
7:26 AM
we could have also accepted doYourThang()
 
m59
even better!
 
m59
public function goAheadGoAheadGetDown()
 
I do like the ->getOne() call .. that's a function I use quite a lot :)
 
m59
7:28 AM
my getAll is pretty useless, but it satisfies my obsessive tendencies.
 
Hmm what does Liskov say about changing the constructor arguments? ...
 
m59
I'm a bastard.
 
@JoeWatkins This is perfectly valid and, I'd say, proper way.
 
m59
hmm...so, I didn't think about that specifically, but I was definitely hung up on a whole thing there. I kept wanting to extend the pdo class then wrap it also
 
@m59 lol
 
m59
7:32 AM
exactly why I didn't ^
but that's the only way it can be proper, right?
 
I'd love it if code were funnier ...
 
This switch is simply awesome. :D
 
m59
really?
 
not really :)
 
No, in fact makes me want to cry. :)
 
7:33 AM
morning
 
m59
I don't like if else when I can avoid it.
 
and you're avoiding it with a switch (true)? lol
that's a bit ... hmm, ocd
 
m59
ding ding ding
 
also, you can immediately return
 
@m59 You should use while (true) then. :p Just kidding btw.
 
7:34 AM
Like, you don't have to set the $result variable and then return that at the end.
do { ... } while (false); with a comment that says "don't remove this loop!"
 
m59
@Jack I know I "can", but I assumed that was improper since IntelliJ throws a fit
 
Why would it do that?
 
m59
"your function has inconsistent return points"
 
Pff, that's crap
 
m59
I think switch(true) is freakin awesome some times
 
7:36 AM
switch (true) is crap all the time. :)
 
@m59 so you never have more than 1 return per method? My code would be fugly without multiple returns :o
 
m59
yeah that makes me breathe hard, and not in the good way
 
@Leri messy code :p all you can is to discover how PHP deal with comparison :p
 
Condense that fecking code! ;p
 
7:39 AM
 
@Jack you don't need elseif if you return
 
@Patrick Yeah I know, but I don't like the line with single } on it :P
 
BTW, am I only one who thinks that doing that clearly violates SRP?
 
@Leri I think that's the whole idea :)
 
morning all.. isn't proud of the 5 hrs sleep though.
 
7:40 AM
public function violateAllTheThings()
 
m59
lol
 
hm.. I've got
switch(true)
{
   case 0: echo "I need more money".PHP_EOL;
   case false: echo "The Universe is broken".PHP_EOL;
   case 1: echo "I seems I'm alone".PHP_EOL;
   case '': echo "No country for old men".PHP_EOL;
   case 'yay': echo "Finally, something wonderful".PHP_EOL;
}
..and it's
I seems I'm alone
No country for old men
Finally, something wonderful
why '' is treated as true? :p while 0 isn't ?
 
Seriously?
 
yeah
 
Because "no break;"
 
7:42 AM
got it
early morning for me
 
heh
 
haha. good catch
switch(true)
{
   case 0: echo "I need more money".PHP_EOL; break;
   case false: echo "The Universe is broken".PHP_EOL; break;
   case 1: echo "I seems I'm alone".PHP_EOL; break;
   case '': echo "No country for old men".PHP_EOL; break;
   case 'yay': echo "Finally, something wonderful".PHP_EOL; break;
}
 
@m59 create an object to represent a query, extend it to create an object for each query type. a switch is often an indicator that you should use inheritance instead.
 
now only
I seems I'm alone
 
Also, it should be die("I seems I'm alone\n"); haha
 
7:43 AM
@AlmaDo Yeah, almost 11:40 is early morning. :Ь
 
but- yeah. no strict comparison
 
Yeah, it compares with ==
 
@Leri depends of when you've went to bed
 
3 am. :p
 
I'm at ~3 and waked at ~8
 
7:45 AM
Off to real-world work. Later.
 
@Jack hm. wait. var_dump(true=='yay');
it's true...
 
switch(false)
{
   case 0: echo "I need more money".PHP_EOL; break;
   case false: echo "The Universe is broken".PHP_EOL; break;
   case 1: echo "I seems I'm alone".PHP_EOL; break;
   case '': echo "No country for old men".PHP_EOL; break;
   case 'yay': echo "Finally, something wonderful".PHP_EOL; break;
}
-> I need more money
 
Hey that's cool :)
 
yeah. why not '' ?
and why 'yay' isn't true with == ?
 
break makes it quit after the first match
 
7:47 AM
crap me
 
@AlmaDo wat
 
I'll know how to catch myself now
 
var_dump(true == 'yay'); // bool(true)
 
@Jack nevermind
 
Go get some caffeine!
 
7:47 AM
lols... Al needs coffee
 
@JoeWatkins I was playing around with this today :)
But it being two years old means some things have changed inside.
Somehow it doesn't like INIT_FCALL_BY_NAME opcode with a TMP_VAR as its operand ... still trying to figure out why.
For other non-core devs .. I'm trying to revive list comprehension discussion for php :)
 
Good morning! :)
 
@Jack what's that doin ?
(not seen it before)
 
@JoeWatkins List comprehension? :)
 
7:59 AM
Without knowledge of any C programming language, is it hard to dive into Objective-C?
 
It helps to know a few things of C.
 
@Jack I mean the syntax, if it's what I think it is, bit strange isn't it ? show me ?
 
$doubles = [foreach ([1, 2, 3] as $number) yield $number * 2]; // [2, 4, 6]
 
^ odd
 
It's like array_map() except that it fully supports generators.
And it can use the keys
@AlmaDo Not much different from Python.
[number * 2 for number in numbers]
okay, so it's shorter, but not that much shorter :)
 
8:03 AM
I have no experience in python :\
 
List comprehensions are nifty.
 
so what's the benefit? In comparison with array_map()? I see only one - keys
 
List comprehension supports Traversable.
 
"it" = what here?
that syntax?
 
Yeah.
 
8:06 AM
I'm not sure, remind me.. array_map() doesn't? I.e. expects strictly array?
 
Yeah, array_map() expects an array.
 
well, then benefit is obvious
 
Also, array_map() calls a function at each element.
 
yes, it does. And here? Isn't for each element we'll do * 2 ?
 
Yeah, but that's an expression ... i.e. ASSIGN, MUL, YIELD.
 
8:07 AM
since we're only looking at the parser, so discussing syntax ... I like the idea, but the syntax looks weird, my fingers don't like typing it ....
 
It's like writing a generator.
Of course, it is a generator heh
 
I like the idea of changing array_map (oh, of course with backward compatibility) so it will accept traversable and array keys
 
can you see any alternatives ?? I really did try to copy/type it ... my fingers aren't liking it ... they're not really used to [] yet :D
 
@AlmaDo I think that ship has sailed :)
 
@Jack sailed = failed ?
 
8:09 AM
@JoeWatkins Now that the short array syntax has been used more often .. :)
 
we can't treat arrays as anything but arrays ...
or more importantly, we're not allowed to treat anything that is not an array as an array
 
for me it's just weird that for similar extension of existing thing we'll need new syntax :\
 
strange rules for a dynamic language ... but whatever, don't fight it :)
 
@JoeWatkins yeah. same root as for scalar typehinting?
 
@AlmaDo The fact that array_map() doesn't support Traversable is not really the case for needing the list comprehension syntax.
 
8:11 AM
well I can't see any alternatives that don't look just as strange, I guess it would grow on me ...
 
@Jack in that - I agree. It isn't the reason (or - very weak reason) for new syntax. And that's my point - if we can improve existing thing - it's better to do that rather than inventing 5-th wheel ..
 
The fact that list comprehension is a generator and can yield array keys as well as values makes it a nice addition imho.
@JoeWatkins In any case, I've written to Nikita personally to see how he feels about this :)
I don't mind giving up some of my own time to clean up the earlier work.
 
I can't say it's bad idea or bad syntax. It's a little bit... odd :p
 
It's expressive =D
 
then do it via | like in ruby :p
 
8:15 AM
I'm not properly awake yet, I'll run it later and have a look ...
 
So now you have two problems :) — Jack 8 secs ago
^^ and it's not even about regular expressions heh
 
8:30 AM
@Jack I mean like arr.map { |a| 2*a } #=> [2, 4, 6, 8, 10] - but for PHP
that's... shorter :p
 
That's ehm ... okay =p
lol
apparently that character causes confusion lol
 
Morning
Fresh OSX install :D. Very happy with that.
 
morning @salathe @Fabien
 
9:17 AM
@rdlowrey balls. I take it that it was building fine with those exts before as well? I guessed there must be some reason why that wasn't done in the first place, I'll se if I can work out what it is. My guess is that it causes a double-free somewhere, probably because of zend's GC, may be preventable. I actually have a use case where I would really like to know what libxml's mem usage is :-(
mornings
 
moin
 
anyone ever manage to build 5.3 ??
@Jack you were trying that a while ago iirc ?
 
@JoeWatkins I did years ago, why, is it supposed to be difficult? IIRC it just sort of worked
Not tried for at least a couple of years though
 
something wrong with parser for me, can't build at all ...
got a bug there with pthreads apparently ...
 
9:31 AM
@JoeWatkins Wasn't there something about needing a specific version of bison at the time?
Give me half an hour to have this meeting I'm about to go into and I'll have a crack at it
 
cool ta
 
[off topic] <3 John Frusciante but really check this out: youtube.com/watch?v=oMGgi4VhfQo
 
moinz
 
9:42 AM
@Fabien is OSX free? or do you have to pay? :-{
 
Work
So free-ish
 
@mAsT3RpEE: Of course it's not free. You have to pay. In unicorn dollars ;)
 
NEVER! Only thing I pay for is buggy windows products.
 
you pay with your dignity ... :D
 
@JoeWatkins Yes and I gave up.
 
9:46 AM
bravely ...
 
Can't remember the exact issue .. let me check
> TSRM/TSRM.h:110:46: error: unknown type name 'THREAD_T'
Now I remember ... it doesn't know what THREAD_T is
 
I got stranger errors still
language parser can't be built ...
 
Useful Google is useful
Oh .. I resolved that by using an ancient bison
 
nginx: [error] invalid PID number "" in "/usr/local/var/run/nginx/nginx.pid"
:(
 
pthreads getting nice amount of upvotes on reddit ... but I fear ... nobody understands enough to speak ;(
 
9:50 AM
People are not designed to be thread compatible.
 
you so are, you are so good at it you are unaware of your capability ....
event a plant is engaged in multi-tasking ... it depends how you look at it ;) and how brave you are ...
 
Hmm, 5.3 may not be compiling because it didn't detect any suitable thread lib
 
but the idea was to make it simple, if nobody understands two years in, except about 6 people in this room ... then I sorta failed ...
 
@Jack I like that syntax :-)
 
I've always wanted to make coffee and shower at the same time ... can pthreads help?
 
9:53 AM
Do you still have problems or does it work now?
 
@bwoebi :D
Just got home ... I have to load my diff's first.
I was sneakily doing this at work hehe
 
10:04 AM
@Jack I'm telling !!!
 
go ahead heh
 
@Touki ping
 
@Gordon Hello
 
@bwoebi Okay, the code starts with this basically.
It wraps up a [foreach ($x as $y) yield $expr] into a closure and then run it ... i don't care about its return value yet.
 
@Touki i need to use an entity from another bundle. I know there is "something" to achieve this in a way that provides loose coupling for such a case built into Doctrine or Sf2. But I cannot remember the name of it. Do you happen to know what it is?
 
 
thanks
 
@bwoebi The error I get is Function name must be a string ... but the opcodes sort of look right.
 
Considering asking my boss if I can go to majorca for PHPUCEU '14 :-)
 
@Jimbo yes, do so because I will be there
 
@Gordon Awesome man - I went to the last one, learned a lot, may even give a talk there
 
10:12 AM
@Jimbo yes please
 
:D
Shame it's not in Germany again, I loved ze german beer
 
ze belgian beer is nice too :)
@bwoebi Here's the Vulcan output: gist.github.com/datibbaw/fc691da0e8e5eadc794e
 
Epic fail..
 
Can anyone provide a little help with my nginx setup on osx. I am getting the error:
*40 connect() to unix:/usr/local/var/run/php/php5-fpm.sock failed (2: No such file or directory).
Here is my config http://pastie.org/private/unhzu6bteuf5nze4e0wyw
502 bad gateway
I guess because there is no php folder in /run -_-
 
10:59 AM
@JoeWatkins Yay, no more error about "function name must be a string" .. now I get segfault .. much better >D
 
@Jack That whole thing is kinda weird, IS_TMP_VAR != IS_CONST is always true...
 

« first day (1243 days earlier)      last day (3720 days later) »