« first day (1034 days earlier)      last day (3900 days later) » 

8:07 PM
Is it a really dumb question?
 
@cheesemacfly no
I just can't explain it
 
Or maybe this is the wrong question
 
maybe @ircmaxell can explain it. he's good at these math things
 
To be complete, I first was confused by this answer before seeing yours: stackoverflow.com/a/2673808/1443490
(I don't care about the performance I just did google "float to int php" or something like this)
And I just though that this answer was wrong if I compare it to your answer (which is quoting the php doc)
Seems to me that the correct way to do would be $x = (int)round($i/3) but I felt it was overkill since $x = (int)($i/3) gives the same result if $i is an int (at least as far as I have seen)
 
8:23 PM
Is there any way to define phpunit option inside the config itself?
Such that $ phpunit === $ phpunit --stderr
 
@an1zhegorodov Not sure what you are asking about?
Do you want a bash alias?
$ alias phpunit="phpunit --stderr"
$ alias phpunit
alias phpunit='phpunit --stderr'
 
@LeviMorrison I have a method with header output. In order to avoid header error when testing I redirect the output to stderr. So, is it possible to specify that option in phpunit.xml config?
 
...sounds like a bad testing setup anyway.
When you have tests, you need seams to stop side effects.
In this case you need a seam for your output or header or both.
 
8:39 PM
@LeviMorrison Could your advise any read on that subject?
 
@an1zhegorodov Actually, this playlist I just found is great: youtube.com/playlist?list=PLD0011D00849E1B79
2
 
Clean code talks are awesome. Have watched each vid a couple of times. Missed the seams part probably
 
They are worth watching at different points of your coding journey because you've changed and in a different situation.
 
@LeviMorrison I often find myself unable to test my code.
Not because I don't write testable code, but sometimes it just doesn't make sense to unit test something.
How do you unit test an autoloader, for example?
 
:) You can do that one, actually.
 
@LeviMorrison You are so right
 
Whether or not my example is valid or not is up for debate but that's how I did it :P
 
@MadaraUchiha And even though you can test it, it's actually quite useless since if your autoloader doesn't work you probably can't run code anyway. It's a very obvious problem, you know?
 
@LeviMorrison That's what I'm thinking!
 
But that doesn't mean you can't test it.
I'm not sure how many things fall into this type of category. I'd say most things can and should be tested, but I'm not sure how solid that claim is.
 
8:58 PM
Does anyone know of a good Silex quickstart tutorial they would recomend?
 
@Orangepill Is it too long: silex.sensiolabs.org/doc/usage.html ?
 
@Orangepill yea, I'd also recommend RTFM
 
@igorw Noticed your handle popping up in the examples.... are you involved in this project?
 
@Orangepill silex.sensiolabs.org/contributors <-- just read :-D
 
Anonymous
9:09 PM
@Orangepill me believes so.
 
Anonymous
Silex is awesome, its good thing more people use it here,
 
user895378
@Jimbo I've fixed the command line argument issues and also retrieving Amp via composer now plays nice with submodules (and vice versa).
 
Anonymous
more help for me ...
 
@Orangepill yep
 
Anonymous
@Orangepill btw: I started with this: erikaheidi.com/2012/11/21/…
 
9:12 PM
 
@simon_eq Started playing with it last night.. so far it is pretty awesome...
 
any assembly boffins about ??
seem sound ??
 
Anonymous
@Orangepill Have you got your handle on bigger frameworks? like ZF, Sf2, yii?
 
@Simon_eQ no... I've not contributed anything as of yet....
@Simon_eQ the only framework I have really used is ZF1, which I just learned did MVC wrong so my understanding of MVC I think is a little fractured.... I'm trying to relearn it the write way.
 
Anonymous
If you want to learn MVC concept (basics, or a little bit more than that) the "write" :) way, better check this link. Its so awesome. @Orangepill symfony.com/doc/current/book/from_flat_php_to_symfony2.html
 
Anonymous
9:20 PM
 
Anonymous
how mvc sounds to me now
 
@Simon_eQ thanks for the resource
 
> By now, the application has evolved from a single PHP file into a structure that is organized and allows for code reuse. You should be happier, but far from satisfied.
that's the point when I don't get why I would need sf to be happier
 
any mac users in with a few minutes to spare ?
 
user895378
9:31 PM
<-- has a few minutes, doesn't have a mac
 
@JoeWatkins can't you just setup OSX in a VM ?
 
it's painfully slow
 
@JoeWatkins I'm here - not sure if I was actually any help last time though.
 
Anonymous
@Gordon It seems to me like the happiness, was in reference to the benefits of MVC, not symfony.
 
I only got ML images and they never boot after install ...
 
9:34 PM
Ah I see ...
 
older images are so slow that I can't use it for actually debugging for obvious reasons ...
@Danack
gcc -o test -lpthread test.c
./test
pastebin result ...
 
@JoeWatkins By. Your. Command. pastebin.com/yey4s8gB
 
@Danack thnx
 
np
 
@Simon_eQ well, he says I should be "far from satisfied" and things can be improved and I dont need to reinvent the wheel and the solution to that is Sf.
 
Anonymous
9:44 PM
@Gordon ohh, that? I thought, that was a marketing strategy :)
 
Does anyone here know a little bit of nuSOAP?
 
@Simon_eQ yeah. While I consider Sf2 to be a good framework I just dont believe the hype around it.
 
Anonymous
@Gordon I too have problem understanding the hype, here the company only works with sf2 and nothing else.
 
Anonymous
maybe its a French thing..
 
Anonymous
If ZF didn't have the huge learning curve, I would've like to have learned that instead.
 
9:52 PM
Sf2 has a large and active community. The code is well tested and afaik quite flexible. It also integrates a rather mature ORM. The people involved with both are reputable people in the European PHP community, so I guess it also has something to do with peer groups (in addition to just being a good framework)
But a framework is a framework. And like any other frameworks Sf2 forces some idioms onto you.
 
user895378
Sf2 will never be an option for me because it's ultra-slow. The end. That won't matter for 99% of PHP apps. But I prefer to plan for growth. Same goes for <insert your favorite framework here>.
 
Anonymous
Well, I heard ZF has also some corporate backing. Anyway, one thing I hate (at this stage) about using a framework, is that I will be forced to waste my time learning it, instead of mastering the real thing, which in this case is PHP.
 
Anonymous
And, also learning proprietary components that are not core of php, like doctrine, twig, yml ...
 
library all the things. freedom of choice. freedom of development.
2
 
user895378
@Simon_eQ ZF2 is the slowest of all.
 
9:57 PM
the biggest mistakes I did was writing code I couldn't throw away easily.
 
@Simon_eQ well, Doctrine is pretty much the only sane choice when you need an ORM. You don't want to write that yourself. Writing a few simple DataMappers but once the impedance mismatch kicks in you'll find yourself in a world of pain writing that yourself
 
user895378
@hakre +1 ... Just say no to vendor lock-in.
 
not only vendor lock-in, we sometimes even lock-in ourselves and it's the hardest to learn the lesson of that. but the best lesson.
 
@Simon_eQ with Twig I fully agree. I never understood the need for a templating engine that is not vanilla PHP or XML/XSLT
 
anyway, I have to fall into bed.
 
user895378
9:58 PM
@hakre peace out yo.
 
gn8 folks and it's friday :D
 
not yet
 
I'm sure you're the first who posts URLs :)
 
naow
 
Anonymous
@rdlowrey didn't know that about zf. Althought, I read that sf2 is 3x faster than zf.
 
user895378
10:00 PM
@Simon_eQ Prepare to be horrified: systemsarchitect.net/…
 
user895378
And the worst part of that? The benchmark they ran is extremely low load.
 
@Simon_eQ and yml is superfluous. I'd rather use an array or XML
 
@Danack pastebin.com/FvwV1Bwj same again please ?
 
user895378
ab -c 20 -n 500 -k
 
(output too garbled to tell what is going on in first test)
 
user895378
10:02 PM
Any benchmark less intense than 1,000 simultaneous clients is a waste of time. The linked benchmarks use 20 simultaneous clients. That's ridiculous.
 
(if you can compile both and ps aux | grep test and show me that too)
 
@Simon_eQ it depends a lot on what your application does. The Hello World benchmarks you find on the web are rather pointless. For instance, in ZF1 it made a world of difference whether you used DateTime or Zend_Date and $also whether you used this->getHelper('foo') in a View or $this->foo through magic. The latter was much slower in our app.
 
@Gordon While I also don't particularly like Twig, having variables escaped by default, and functions bound by shorthand is nice.
@JoeWatkins running now - seems a lot slower and CPU has gone crazy
 
@Danack if you create them with DOM you get automatic escaping, too. And you can bind any custom tag to whatever you want.
 
user895378
@Simon_eQ And compare those numbers to node.js, which in equivalent tests can do about 12,000 requests per second with 1,000 concurrent connections and you start to understand why people like me insist that PHP frameworks are not all they're cracked up to be.
 
user895378
10:05 PM
Again, for the vast majority of sites performance will never be an issue because they'll never encounter high load. But run into a reddit avalanche and you're screwed.
 
@JoeWatkins Do you mean compile and run both at once? I saved the new file as test2:
Dan-Ackroyds-MacBook-Pro:~ danack$ ps aux | grep test
danack 40895 383.3 0.0 2440048 444 s001 R+ 11:05pm 2:59.51 ./test2
danack 40909 0.0 0.0 2435120 540 s002 S+ 11:05pm 0:00.00 grep test
test2 pastebin pastebin.com/Z9i8Bgx0
 
@Danack
bugger ...
my head hurts, I need thinking time, we'll go back to it ...
 
The original one runs too fast to run "ps aux | grep test " while it's running
 
@JoeWatkins yes
 
thnx
@igorw I forgot the question ??
 
10:08 PM
@Gordon Can you disambiguate 'DOM' please?
 
cheers - does that allow you to do something like {$username} in a template and have it safely escaped?
 
@JoeWatkins you wanted someone to test something on osx?
 
@igorw oh thanks I got a tester, back to thinking ... thnx tho ...
 
@rdlowrey are the individual code samples, instructions and server configs available?
puppet config or gtfo
 
user895378
10:14 PM
@igorw No, that's obviously a garbage benchmark but it's still representative of the relative speed of frameworks.
 
user895378
It doesn't matter how efficacious the test is you'll still get similar results, so don't play that card :)
 
user895378
The difference may be mitigated but not eliminated. Not even remotely.
 
it's really hard to tell. I know sf does some fancy stuff with pre-compiling. if you don't use those, if you don't use the prod front controller, etc. then the result would not surprise me.
 
@Danack yes. See codepad.org/eE1MPgkj
 
user895378
I'll be happy to change my viewpoint, of course, if ever I see a valid benchmark to demonstrate that symfony or any other framework can run faster.
 
user895378
10:16 PM
I just haven't yet.
 
... and I am awake again
 
user895378
The problem with 99% of benchmarks you find on the internet is that people have no idea what they're doing. Is opcode caching disabled? Fail. Not using keep-alive connections? Fail. Doing anything other than hello world in your benchmark? Fail. Only using a few tens of concurrent client connections? Fail. The list goes on and on.
 
@igorw puppet sucks
 
@rdlowrey well, a hello world benchmark might even make sense if the rest of the config is properly optimized.
 
user895378
Yeah. Even then there's so much variation in what framework A does versus framework B it's almost impossible to gauge what's actually happening. I can write <?php echo "hello world"; ?> and get 15,000 responses per second but of course I'm vulnerable to security issues, etc.
 
10:22 PM
then benchmark it against <?php echo 'hello world'; ?> .. I'm too slow
 
user895378
Even with node you see this. vanilla node.js http server (on my machine) does ~12k r/s but if you use a node framework like express.js (which you really need to because base node http functionality is extremely limited and not really that useful) that immediately drops down to ~6-7k in my tests.
 
it would be nice if you could benchmark separate components if a framework. But you cannot.
 
@Gordon I agree it is not the most user friendly tool; if you have better ways for reproducible environments, I'd be glad to hear them.
 
@igorw salt stack and ansible are supposed to be user friendlier. i havent tried them yet though. I am still looking for someone to delegate that task to. How about you?
 
@igorw here is an idea - never benchmark frameworks
 
user895378
10:26 PM
@igorw I'm a noob in that arena. I'd like to find something better because I wasn't crazy about puppet either :/
 
if you have choses to write you application on top of a 3rd party framework, you have already decided that optimization is NOT you priority
 
@Gordon have you seen docker? seems like a much saner approach.
 
@igorw not yet. will investigate
 
I'm finding Chef a lot easier to work with than Puppet as you can just call scripts in order, rather than Puppets 'everything must be explicitly dependent on something else'.
 
@tereško I partially agree, but I still think "framework X is slow as a dog, I read it on the internet" is dubious.
 
10:32 PM
code, based on a 3rd party framework, will always be slower then custom code, written by a seasoned professional
 
it works for the adult entertainment industry. sure, maybe they're using fancy caching tricks or just buying more servers. but it doesn't seem to be an issue for them...
 
Given that I have /resource/123/abc, I need to map it back to /resource/$#id/$param. I know that $#id and $param are named that and the values they correspond to, and I know the indices at which they start.
So the question is, how do I properly do the replacement?
 
@tereško that depends on how good you are at writing the code yourself, but yeah, you said seasoned professional. But what if the framework was written by even more seasoned professionals?
 
helo guys i need help :D
Actually i am try to check username name already exist or not! i wrote this script now i want to get user email using his username!
 
It doesn't matter. Frameworks are written to work with everything. And people who write it are extremely unlikely to explain the details of their decisions.
 
10:40 PM
$query = mysql_query("SELECT * FROM users WHERE userID='$username' LIMIT 1");

if(mysql_num_rows($query) != 0)
{

while($row = mysqli_fetch_array($query))
  {
  echo $row['email'];
  echo "<br>";
  }
 
@MalikUsman and now you wonder why that sql injectable query you did with the deprecated ext/mysql extension doesnt work when you run it through ext/mysqli?
 
<3
 
well shall i try mysqli @Gordon does my script looks all right
 
@MalikUsman does "sql injectable" and "deprecated" sound right to you?
 
well i am new :'( so i dont know much sorry :'(
 
10:46 PM
@MalikUsman These are the functions you dont want to use anymore php.net/manual/en/book.mysql.php
 
@gordon its fixed i think i was using my
mysqli i replaced it with mysql_fetch_array
 
@rdlowrey I'm observing something weird and I'm not sure if it's Artax going bananas... could it be that at some failures it goes into an infinite loop?
 
well mysql
 
@MalikUsman and you want to read stackoverflow.com/questions/60174/…
 
10:48 PM
well now fixed gordon thanks ;)
 
@MalikUsman you are welcome, but for the record: if you just removed the "i" then you made it worse
 
Oh :/ well shall i use mysql or mysqli which one you suggest me ?
 
3 mins ago, by Gordon
@MalikUsman You want to use http://php.net/manual/en/book.mysqli.php or http://php.net/manual/en/book.pdo.php
 
4 mins ago, by Gordon
@MalikUsman These are the functions you dont want to use anymore http://php.net/manual/en/book.mysql.php
@igorw <3
 
oh!
 
10:53 PM
@MalikUsman , watch this: youtube.com/watch?v=nLinqtCfhKY
 
ok let me watch ;)
 
im off to bed. laters
 
laters baby
 
@Ocramius I suppose it's possible that any piece of software could have a failure that goes into an infinite loop.
 
@LeviMorrison yes, the problem is I cannot seem to be able to find it :P
so I'm basically looking for pointers :)
 
11:00 PM
Dunno why but he went afk for a bit.
Maybe hit the gym or something; it's about that time of day for him.
 
Can I interrupt for a bit?
I'll take that as a yes.
$start  = new \DateTime('11/05/2012');
$end    = new \DateTime('12/04/2012');

echo $start->diff($end)->format('%a'); # 29
 
You want the sign?
Or what?
 
Have ever encountered software that adds 29 days as "one month" ?
It's dark, I'm typing slowly, sorry.
 
Uh
30 - 5 = 25.
 
I pulled these dates from cPanel thingy, and I can't figure out on what planet is "+1 month" equal 29 days.
 
11:02 PM
And then + 4 days from december.
What's your point?
 
Yeah, I'm fried.
 
@LeviMorrison yes, this is also known as the "halting problem", proven unsolvable by alan turing and alonzo church in 1936.
 
How do you add one month to a date?
How many days is one month?
Is it legit to be 29, or it's an error.
 
strtotime('+1 month', $context);
 
echo (new \DateTime('11/05/2012'))->modify('+30 days')->format('m/d/Y'); # 12/05/2012
echo (new \DateTime('11/05/2012'))->modify('+1 month')->format('m/d/Y'); # 12/05/2012
@LeviMorrison Thank you, now that we solved that. How on earth did cPanel thought it was 29 days.
 
11:06 PM
Dunno.
Datetime is hard.
 
echo (new \DateTime('11/05/2012'))->modify('+1 month - 1 day')->format('m/d/Y'); # 12/04/2012
It sure is...
Thanks!
 
user895378
@Ocramius Hmm. It's not impossible of course. Can you give me some context?
 
@rdlowrey I'm running a fixed set of requests (not doing anything else) in an infinite loop. I'm echoing between each request to see some "ticks". At a random number of iterations the ticks stop to come out, and the CPU goes up
so yeah, that's the symptoms... I have to say that the target URIs are quite unstable (failures in socket, failures in response code, maybe even failures during transfer)
if you got any idea of where I cpuld look I can give it a shot...
 
user895378
Hmm. It's possible that this could be an artax problem. I changed a lot of stuff dealing with how writable/readable sockets are handled not too long ago and your problem is indicative of what happens when a stream "writability watcher" is never cancelled or disabled.
 
user895378
Is there a set of requests/URIs that I can use to replicate it? I know that's not necessarily easy to do with this sort of thing.
 
user895378
11:21 PM
But any context you can provide would be helpful in finding the source of the problem.
 
@rdlowrey wish I could give it to you... I'll ask the product owner
(and sorry for always bothering with this small amount of data :X )
 
user895378
No problem -- I know it's difficult to pinpoint exact reproducible cases with this sort of thing.
 
is there actually a limit in the number of streams?
 
user895378
By default there is no limit.
 
user895378
11:25 PM
But you can set a limit on the number of concurrent connections.
 
yes, what I mean is if there is such a thing os-side
 
user895378
Oh yeah, there definitely is.
 
user895378
ulimit
 
good, I'll investigate on that then
 
user895378
Each socket connection opened counts as a file descriptor.
 
11:25 PM
ah, yes
that can escalate indeed
 
user895378
 
user895378
It's easy to run into the default ulimit for file descriptors when you start doing heavy-duty socket things.
 
user895378
Best to up that on general principle as a developer.
 
hmm
 
user895378
But in regard to the CPU going haywire issue ...
 
user895378
11:28 PM
Socket descriptors are essentially "always" writable. This is not technically 100% true, but we can assume this to be true for our purposes. So when Artax has data to send it enables the stream IO watcher so that it will be enabled whenever the socket can be written to and doesn't disable this watcher until it's finished.
 
well, it starts doing that at ~75k requests :X
 
oh yeah, that actually could match what you linked me
 
user895378
So if the CPU skyrockets its not impossible that I've got a failure to disable the writability watcher on a socket even though there's nothing to be written. This situation is similar to an infinite loop because the callback will be continuously and immediately notified forever.
 
user895378
@Ocramius Do you observe this happening when sending request bodies?
 
user895378
11:31 PM
Or also when establishing encrypted connections with TLS?
 
wish I had the logger enabled... I can try enabling it and running another batch
but it will be done by tomorrow morning
(yes, the log becomes QUITE BIG)
 
user895378
Don't worry about that. Not worth worrying over.
 
user895378
I'll go through with a fine-toothed comb and double-check anything that could have to do with this.
 
there's no encrypted connections here btw
 
@rdlowrey why does this sound so familiar... :)
 
user895378
11:32 PM
There are only a few places that could possibly be affected so I should be able to do it.
 
user895378
Yes, @igorw knows exactly what I'm talking about.
 
eh, that's why I was asking... I think igor mentioned something like this some months ago
@LeviMorrison usage example?
 
function testMultipleRules() {
    $method = 'GET';
    $route = '/resource/123/abc';
    $rule = '/resource/$#id/$param';
    $handler = [__CLASS__, 'handler'];

    $router = $this->makeRouter();
    $router->addRoute($method, $rule, $handler);
    $router->addRoute($method, '/class/$name', $handler);
    $result = $router->matchRoute($method, $route);

    $this->assertEquals($router::MATCHED, $result[0]);
    $this->assertEquals($handler, $result[1]);
    $this->assertEquals(['id' => '123', 'param' => 'abc'], $result[2]);
 
... and I'm out of votes
 
The line $router->addRoute($method, '/class/$name', $handler); doesn't need to be there, just noticed.
 
user895378
11:43 PM
@Ocramius Also, are you using the most recent version?
 
@LeviMorrison for stuff like this it is good idea to use providers : phpunit.de/manual/3.7/en/…
 
@rdlowrey well, the latest tagged one
 
user895378
@Ocramius Okay, just making sure.
 
@tereško It seems like it might be useful but I don't quite understand it yet. I'll have to look at it more and dig up some examples. Thank you for the link.
 
I'm having issues deploying a website I had working perfectly in WAMP and am just a bit frustrated. I'm willing to pay someone $20 USD(paypal) if they're willing to remote into my PC and fix it. Should be a 15-20 min fix I'm guessing.
 
11:53 PM
@LeviMorrison this might help
also .. i should start adding to that codebase starting tomorrow
 
@Alec try turning it off and on again. if that fails, look at all the log files you can find.
 

« first day (1034 days earlier)      last day (3900 days later) »