« first day (1383 days earlier)      last day (3565 days later) » 

7:00 PM
Because I already know PHP and loved it a while ago. Also, cheap and easy.
 
Oh, you didn't start with "I already know PHP" :P
 
Haskell warps my mind. F# is unreadable. Python lists make me cry. Scala is JVM so no no no.
I did! I said I've been out of it for 2~3 years so, in terms of frameworks and PHP 5.3+ features, I know nothing.
 
Read about PHP5.3 features, don't use frameworks at least initially.
 
Sorry for my noobness but in regards to a language what's a specification?
 
That's the best tips I can probably give you :P
@Fabien es5.github.io here's JavaScript (ECMAScript) for example.
 
7:03 PM
php doesn't have a spec, right?
 
@BenjaminGruenbaum I did read up, liked quite a bit of it hence I'm playing around. I just want something that does controller/action routing for me, provides me with a view engine, model binding and some kind of data access layer that provides linq-esque access style and scaffolded models. Basically, your plain and simple framework to do something instead of learning the language.
 
@RoelvanUden PHP is a view engine.
There is nothing like LINQ, nothing even close, there are ORMs like doctrine and methods like array_map but nothing that'll break up an expression syntax tree and built it up as something else yet.
 
@BenjaminGruenbaum I know. I did go down that route on my own frameworks back in the day :-P. I'm pretty sure there are better ways tho.. (e.g. escape all variables automatically, provide helpers for routing etc)
@BenjaminGruenbaum Write your own SQL then?
 
@RoelvanUden writing SQL is perfectly fine IMO. I love LINQ but writing SQL is a perfectly fine way to go.
 
7:07 PM
@Fabien I see
 
@BenjaminGruenbaum I cringe when I see SQL mixed into code though.. repositories it is then?
 
Data mappers mostly.
 
I did try that RedBean thing, I was laughing so hard, it was hilarious to see. What kind of mapper is reasonable then?
 
I think the person here who understands architecture and separation of concerns of actual PHP apps (and not aspects of) here best is probably @tereško , @ircmaxell is very good too but his focus is usually elsewhere.
Probably go through some of his answers.
Data mappers are not repositories, they encsulate mapping data from entities to objects. Repositories abstract an actual well... repository of objects. It's a two phase process but the end result is pretty straightforward and clean.
 
@BenjaminGruenbaum if I'm the best at architecture here, we're all completely fucked
 
7:11 PM
Well, this is the PHP room :P
 
oooh
well done.
 
@tereško is soooo humble
 
On the other hand, Java is known for architectural people and the Java room usually has people drooling, eating crayons, arguing in Indian and forgetting who they are.
Seriously - do not go there, it's not a pretty sight.
 
Well, fuck, I just want routing, model binding, and safer views. Apparently I should just roll my own custom toolkit for that then?
 
@BenjaminGruenbaum nothing wrong with eating crayons or with drooling
 
7:13 PM
I like green.
 
@RoelvanUden you can use a library for routing and model binding, and as for safer views I don't really believe in those since not a single templating engine I ever used helped there really.
 
I like blue.
 
Even simple engines like Handlebars helped with the {{mythingy}} syntax with automatic escapin'
Hm. Lol, slimframework.com. Looks simple enough? :P
 
@RoelvanUden ... well, there is this "composer" thing. You can assemble your application from various libraries. Each doing one thing.
 
@RoelvanUden every single mustache code base I worked with had an XSS vulnerability :D Escaping is contextual, people escaped with {{}} in attributes, and in script tags and in all sorts of places. It did not go very well for them :D
 
7:16 PM
Using your brain is still required, yeah...
 
@RoelvanUden you can use github.com/nikic/FastRoute
 
/me thinks that "make your own routing lib" is quite a good exercise
but , yeah , @NikiC's lib is probably quite OK
 
@tereško only if it's allowed that it's slow.
 
@bwoebi "slow" can be fixed with caching decorator (have been exploring this concept)
 
7:26 PM
@tereško what do you want to cache?
actually Nikita caches the compiled regex. But I assume you don't have a compiled regex with your own little router.
 
yeah ... I actually looked at the API just now
=/
someone has welded the dispatcher to the router .. there is nothing that you can really cache aside from the regex patterns
I really have to finish my own routing library
 
so, what did you want to cache?
 
@tereško wrote a reverse proxy, can confirm
 
Lol wow. Is this considered bad?
$app = new \Slim\Slim();
$app->get('/:name', require('./routes/home.php'));
$app->run();
In file #1.
<?php return function ($name) {
    echo 'Hello world, my name is ' . $name;
};
In file #2.
 
@bwoebi If you're using a long-running PHP server you can cache URL => dispatch result.
 
7:31 PM
@bwoebi the results from the regular expression (you would avoid the act of actually finding the matching route and splitting int into parameter, and preparing said parameters): you cache the computed values for the specific query
 
Whether or not that makes sense depends on usage pattern
 
@NikiC yeah, I'll cache a few gigabytes for every combination.
 
@bwoebi You can construct this on the fly and with limited size ^^
 
@NikiC I'm not persuaded.
 
@bwoebi IIRC @rdlowrey was doing something like that. Don't remember the details though.
 
7:33 PM
when your router is also a dispatcher, it becomes quite limited
 
@NikiC There's no such thing in Aerys.…
 
@bwoebi is it stable ?
 
I think I'm going to start walking out of meetings with startups where they try to get me to sign an NDA before I even contract with them. I'm not going to steal your idea for creating a Myspace for Cats, bro, settle down.
 
can I actually use it in production environment ?
 
Worst lunch meeting ever.
 
7:34 PM
what? Aerys? no. Arya, yes.
 
@RoelvanUden looks good to me. Apart from run using globals.
 
@Chris So if they are an established company you'll be willing to sign the NDA before you contract with them?
 
@RoelvanUden yeah kinda is. This basically automatization of include-oriented programming.
 
@LeviMorrison Maybe. Established companies don't write checks that bounce.
^ generally speaking
 
coooold beeeeeeeeeeeeeer
 
7:35 PM
I haven't worked for Intel but every time they meet with us they have always double-checked that we have an NDA.
 
@tereško Would you mind elaborating a little when this becomes cumbersome?
 
Dependency injection.
Although you can do currying and call_user_func(require('./routes/home.php'), $dependencyA, $dependencyB).
 
@RoelvanUden when you do not know, where some of the variables, that are used in the included/required file, come from
essentially, you end up running your code in some arbitrary scope
 
user895378
@bwoebi I do have a caching route dispatcher locally that would be ideal for aerys and is lighting fast in a long-running server context. Not useful for the web SAPI without some sort of weird caching, but a big win for aerys. It's just sitting around unfinished locally, though. At some point after I finish all the other things I have to finish I'll PR it to FastRoute.
 
user895378
7:38 PM
/cc @NikiC
 
How's your work on Artax going? @rdlowrey
 
@rdlowrey wouldn't it make more sense to have an independent router, that produces the request abstraction (or maybe just a hashmap of parsed values. Which then gets consumed by independent dispatcher
 
user895378
@bwoebi Well. I've spent most of today moving things into a new repo that exists to simplify non-blocking sockets and offer the 5.6 client TLS features in userland for 5.4/5.5
 
this way you can case the abstracted request for a specific query
and you can still cache the dispatch results too
 
@tereško if by caching decorator you mean a JIT then most certainly. JITs are actually amazing at routing code.
 
user895378
7:41 PM
^ That's essentially what it does.
 
user895378
list($resultCode, $callable) = $router->route($request->getMethod(), $request->getUri());
 
@rdlowrey oh, not yet pushed.
 
user895378
no, it's just hanging out in a local directory
 
<?php

$dispatcher = FastRoute\cachedDispatcher(function(FastRoute\RouteCollector $r) {
    $r->addRoute('GET', '/user/{name}/{id:[0-9]+}', 'handler0');
    $r->addRoute('GET', '/user/{id:[0-9]+}', 'handler1');
    $r->addRoute('GET', '/user/{name}', 'handler2');
}, [
    'cacheFile' => __DIR__ . '/route.cache', /* required */
    'cacheDisabled' => IS_DEBUG_ENABLED,     /* optional, enabled by default */
]);
 
user895378
Adding tests and things now.
 
7:43 PM
this was the code sample that I looed at
it made me kinda sad
 
user895378
Because it's not object oriented?
 
@tereško what's wrong with it?
 
because of 'cacheFile' => __DIR__ . '/route.cache', /* required */
 
@tereško yep. And?
 
user895378
If you want to cache things to a file you kind of need to specify a file name.
 
7:45 PM
hey, I never said that I have actually explored the codebase =P
its 30°C at 23:00 , and there are beers
give me a break =(
 
user895378
I need a nap.
 
also, I started with
27 mins ago, by tereško
but , yeah , @NikiC's lib is probably quite OK
 
user895378
Does anyone know if there's an accepted way to tell composer "include this functions.php file in the bootstrap?"
 
I just gave up and opted to use composer-style file structure for composer libs
 
user895378
Me too. It's like the Borg. It's just taken over and if you don't do it people get pissy.
 
7:49 PM
... and made a composer package for my own classloader which then is used by the real application
 
user895378
Nevermind, found it:
 
user895378
    "autoload": {
        "files": ["test.php"]
    }
 
yay
I hope I will remember this later
 
@rdlowrey can you specify two autoloaders? one to load the functions.php and one to use psr-4?
 
user895378
@bwoebi I assumed so. I'm about to try. I'll let you know if it does/doesn't work.
 
7:51 PM
good
 
user895378
I'll be very put out if it doesn't work.
 
@bwoebi you can use composer to load your "real autoloader" which you then initialize in the buutstrap, right after require '../vendor/autoload.php';
that's what I do
/me is watching Stargate SG1 s01e01
 
Oo.. such a relic
 
yay! constant propagation and dead code removal is done :-D
/**
 * @param int
 * @return int
 */
function test($a) {
    $b = 1;
    while (0) {
    	$b += $a;
    }
    return $a + $b;
}
 
@ircmaxell What about redefining a constant later?
 
7:53 PM
gets turned into function test($a) { return $a + 1; }
 
Oh, I see.
Literal propagation, not constants.
 
@LeviMorrison treated the same internally.
 
Constants aren't constant in PHP though.
 
they're constant once defined.
 
constants are "strange globals"
 
7:54 PM
@LeviMorrison my support of them is. They get resolved at compile time (when the byte cote is generated, which is in the request), and then aren't accessed again...
 
user895378
@bwoebi works just fine. The relevant composer section looks like:
 
user895378
    "autoload": {
        "psr-4": {
            "Acesync\\": "lib/"
        },
        "files": ["lib/functions.php"]
    },
 
Acesync? :o
explain that name?
 
user895378
Pronounced like "async" ... we had a whole discussion earlier. Maybe it doesn't translate as well if you aren't a native speaker. "Ace" has a generally positive connotation.
 
AAA100%TopBestSynch
 
7:57 PM
It's cool.
 
@rdlowrey I was reading that like ace-sync, not async
 
user895378
It's pretty sweet that you can do this in 5.4/5.5 and get all the same benefits of having 5.6 from a TLS standpoint:
 
user895378
$sock = Acesync\cryptoConnect('www.google.com:443');
 
@bwoebi same here. I assumed it was a tool for syncing
 
@Gordon Maybe because American?
 
user895378
8:01 PM
Aces, Inc.
 
@bwoebi because Ace Sync = TopNotch Sync
 
never heart of.
 
user895378
$sock = Acesync\cryptoConnect('www.google.com:443');
fwrite($sock, "GET / HTTP/1.0\r\n\r\n");
while (!feof($sock)) {
    echo fread($sock, 8192);
}
 
user895378
Secure TLS for all \o/
 
user895378
/cc @DaveRandom
 
user895378
8:06 PM
functions FTW.
 
user895378
@Ocramius you'll be happy to know that composer has now nosed its way back into first place in my personal "deployment strategy preference" race.
 
user895378
Poll: is the following function name too long? synchronousCryptoConnect($uri, $options)
 
yes
cryptoConnectSync maybe?
 
user895378
That's what I'm using now, actually :)
 
... which is node.js' convention, actually.
 
user895378
8:13 PM
I have cryptoConnect() and cryptoConnectSync() for the synchronous version
 
user895378
I did not know that.
 
user895378
I'll just keep it as-is, then. Thanks for the input.
 
@rdlowrey lol
 
@rdlowrey no
 
8:16 PM
md5.
Is it outdated?
 
@DemCodeLines depends for what
 
storing passwords and matching passwords when user is logging in.
 
yes, outdated.
 
@DemCodeLines yes
 
password_hash
 
8:18 PM
not only is md5 outdated for passwords. its considered insecure and harmful for that purpose
 
password_hash, password_hash and only password_hash. Unless you're running an older PHP, in which case use password_compat to get it.
 
I'm working with another developer and they did all the stuff in md5...
while my part of code is password_hash.
and we have to integrate logins...
sigh
 
@DemCodeLines chain authentication. when a user authenticates, try the secure hash first. if that fails, try the md5. if that succeeds, create a new secure hash and update it in the db. easy to build. least hassle for users. they wont notice.
 
^^ this
 
:-)
@Gordon or just detect that it's not a secure hash by doing string matching on it
 
8:26 PM
@ircmaxell i am assuming they are sending the plain text password from some sort of login form. how would you do that then?
 
@Gordon he probably means checking out the old hash
 
oh right. yes.
 
guys, what stackexchange site would be the most suitable for debian-specific question: unix or askubuntu? or there is something else?
 
user895378
Probably Server Fault, no?
 
I knew I missed something obvious, thanks
 
8:32 PM
what kind of debian-specific question?
 
@CarrieKendall locale generation
 
i'd definitely say server fault then
 
@FlorianMargaine that
 
someone :D
 
0
Q: locale-gen does not generate any locales

zerkmsFor some reason on a server the locale-gen en_NZ.UTF-8 command does not generate the given locale. $ locale -a C C.UTF-8 en_US.utf8 POSIX It is in a list of supported locales though: $ grep en_NZ /usr/share/i18n/SUPPORTED en_NZ.UTF-8 UTF-8 en_NZ ISO-8859-1 Then I checked if I could gener...

 
8:43 PM
@zerkms This question was voluntarily removed by its author. ?
 
user895378
Is there any equivalent to error_get_last() that gives you access to errors further back? Like three errors ago? I assume, "no," but thought I'd ask.
 
user895378
(it would seem silly to keep more than the most recent error in memory)
 
@rdlowrey I guess that would be the regular error log then
 
anyone here know oracle sql?
 
hello guys, i have a question: i want my app to send a picture on a php website, when the website request it. How can i do that? I made that the app should always request a "status" from php (every 2 second) and if the php has setted the status to "yes" the app should send the pic (as bytes), but like this isn't very good. I dont want to keep requesting the php, i just want that when i change in php the "status" my app should see it and take action.
any ideea ?
 
8:50 PM
why does the PHP manual say it's powered by PHP/FI? It's not April's fools
@LeviMorrison @salathe ^
 
@Gordon some of the PHP servers are using ancient versions of PHP :-P
 
@Gordon But it's End-July-Fools. You didn't know about it?
 
@ircmaxell that that ancient?
 
@Gordon The logo rotates sometimes.
Then because of cache it stays there for a bit.
 
aha
confusing
 
8:56 PM
I even reduced the chances for alternative logos a while back by a tiny bit.
 
add a powered by PHP6 :)
 
I'd like to remove it altogether, personally.
(Except for april fools and such)
 
@Gordon add powered by PHP 8.
 
user895378
+10 internet points for anyone who manages to sneak in a Powered by PHP "7" line somewhere on php.net.
 
@bwoebi or just make it a random number
 
user895378
8:57 PM
(quotes around the "7" are mandatory)
 
@Gordon no...
 
CREATE TABLE venice_user_tags (
                           id INT NOT NULL,
                           user INT NOT NULL,
                           tag INT NOT NULL,
                           PRIMARY KEY(id))
what the heck is wrong with this...?
 
@rdlowrey great idea.
@DemCodeLines I miss at least one parenthesis.
 
@bwoebi it exists, just didn't copy that part for some reason
this is oci by the way
no one :(
 
@DemCodeLines Oracle usually gives you error codes
 
9:03 PM
@Gordon ORA-00904: : invalid identifier
 
Maybe using an identifier that is a reserved keyword?
 
but what can be reserved over there?
 
this exact same code for another table worked with different names.
 
definitely User
 
9:06 PM
MySQL background is kicking in, it seems
 
@rdlowrey Could snag that really quickly :D
 
someone can help me with "Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given"?
 
7
Q: PHP & MySQL: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given

TaGI'm trying to Integrate HTML Purifier http://htmlpurifier.org/ to filter my user submitted data but I get the following error below. And I was wondering how can I fix this problem? I get the following error. on line 22: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given ...

And stop using mysql.
Use PDO or mysqli.
 
Thanks for your link Charles, but In that topic, user had a error in his sql statment. But in mine I dont see any error
 
9:24 PM
@Marby the error message is pretty straightforward. the function expects a resource but you passed a boolean. so find out why its a boolean.
 
I store the result of my query like this: $result = mysql_query($query);
 
@bwoebi yep, removed it since I made a stupid assumption that debian and ubuntu locale-gen behaviour should be similar
 
and then Im using mysql_num_rows with my $result, to count how many rreows my query returned, so I dont see how Im getting a boolean here
 
@Marby check the PHP manual for that function to learn what it will return when
anyways, im out. nite all.
 
ok! thanks for your tip
 
10:01 PM
I just was called a freak because I preferred writing $var >>= 2; instead of $var = (int)($var / 4);
4
 
Uhm... that you prefer it that way is kinda weird, yeah
 
I may have gone too far this time
my optimizer now aggressively removes dead code...
well, dead code isn't the way to describe it... Un-necessary code is...
 
like... removes functions with side-effects?
 
@rdlowrey ping?
 
this is going to screw up an entire class of benchmarks :-P
 
fuck , I have to wake up in 4 hours
 
do not look at the clock =]
 
You have to wake up at 4:30am?
 
user895378
10:26 PM
@DaveRandom yo.
 
@rdlowrey So I've been looking at this whole Reactor iface pecl thing
 
@ircmaxell just return something?
 
I think, in the interests of playing nice with React and because it generally makes sense it's worth having a void nextTick(callable) function
thoughts?
I notice you don't have one, wondered if there was a good reason why
 
@bwoebi well, but that's the point. If the computation has no effect on the result, unless it has a side-effect (like a function call), don't even run it
 
@ircmaxell That makes sense. And I like that too.
 
user895378
10:29 PM
@DaveRandom The reason why is that it's the same thing as Reactor::immediately()
 
No point in artificially leaving unnecessary instructions here, just for benchmarks
 
user895378
And I had that feature first :)
 
user895378
The name is unimportant to me, though.
 
@bwoebi yeah, but it's expensive (to compile that mandel function takes about 1/2 of a second)...
 
@ircmaxell It might be worth it. But what makes it so slow?
 
10:31 PM
@rdlowrey It's not though. Functionally it is, but it allows you to bypass the routine that looks for the right place in the timer stack to insert the callback, thereby making it more efficient to schedule it and removing the branch from timer execution loop
 
@bwoebi well, it requires an O(scary) process over the graph to iteratively identify and remove redundant nodes...
 
user895378
@DaveRandom Only because the NativeReactor implementation is screwy and I haven't fixed it.
 
user895378
That's what it's supposed to be. But again, I don't ever use the NativeReactor. The libuv and libevent versions work as expected.
 
@rdlowrey yeh so I totally misread something :-P ignore me
Right so I'm going to bounce this off cboden and igorw and see what they think, and then I'm going to try and put something together
Who do I have to talk to about creating a new PECL repo?
This is a somewhat premature question but just wondering
 
@ircmaxell Then make it O(less-scary). I just can't tell you how.
 
user895378
10:35 PM
@DaveRandom maybe Pierre. But who cares about PECL for now. Just make something that's usable first :)
 
@bwoebi well, there are definitely places I can improve. For code simplicity I'm using an O(n^2) algorithm to compute inbound-degree, live. I could make that an O(1) op. Which would reduce overall complexity. But point being that there's a lot of essential complexity that goes into it though...
 
user895378
@DaveRandom I'd love to assist and help out as well once you have a basic skeleton as well ... I think this is one of the most important things that need to happen for PHPNEXT.
 
user895378
And I don't care a lick about retaining any of my own nomenclature -- just want something that works.
 
Meh this is just an iface, the tricky bit is making stuff that implements it
 
user895378
But to do what we want I think a new SAPI is what's needed -- not an extension
 
user895378
10:38 PM
Because if all we want is an extension then we already have those.
 
@ircmaxell how much is O(scary) then, without that O(n^2) algorithm?
 
@bwoebi computationally unaffected...
 
user895378
We either need a new SAPI that adds this functionality on top of CLI, or more likely, we need to add it to the request routine period so that it's available in all SAPIs.
 
that's how bad the current implementation is
but it works (mostly)
 
hmm?
 
10:40 PM
@rdlowrey I don't know about you, but I am not capable of re-engineering the paradigms used at the very core just yet :-P
 
user895378
@DaveRandom Well I've looked at it a bit and I honestly don't think it's any more complicated than doing an extension.
 
@bwoebi if the O(scary) was O(n!), then removing and O(n^2), even on every iteration, wouldn't reduce the complexity from O(n!) (because the ! dominates the n^2 on every iteration through)
 
user895378
brb, restarting because windows.
 
on a releted note, since I know you have been dealing with exactly this issue recently, @bwoebi how do I specify an optional param in an interface?
 
My App Store is genius. I have installed OS X 10.9.4 6 times in the last 30 days, it tells me.
@DaveRandom well. All I've done was git revert.
 
10:42 PM
lol :-P
I've been poking through it and I can't see a sane way to say "this param is optional" without also saying "this is the default value" in a way that will be hard to override
 
I have some issues with the current interface semantics.
IMO it should reflect the language semantics, not some formal semantics.
 
^ this. It seems very odd that I can easily do something in userland that is messy at best internally
 
e.g. interface a { function b ($x = 1); } class c { function b () { return 1; } } should work and not give a fatal error.
because, we can always pass more parameters than needed in PHP without error.
 
@bwoebi ...in userland. But to be fair that's only because proper varargs didn't exist
 
covariance is hard to implement
 
10:47 PM
@ircmaxell not only. Also hard to define sanely.
 
yeah
 
@DaveRandom for me it's more like a feature.
 
especially as "is b() really contravariant to b(x=1)". Sure it "behaves" like it, but is it...?
 
@ircmaxell I'd say yes.
 
well, that's the question that's important... In some cases, yes it is. But I'd argue that there's no param at all, so is it really contravariant?
or covariant (I can never remember which is which)
 
10:50 PM
Well I'm not entirely on board with @bwoebi's example, the interface dictates that I can pass a param to alter the behaviour, if the implementor does not accept the arg that behaviour cannot be modified
 
example, b(x=2) could be considered covariant
 
I'm also a bit confused by the two words.
 
The implementor can choose for there to be no difference, but the caller needs to know that the param can be passed regardless
 
@DaveRandom you always can pass more params than the callee needs.
 
@bwoebi Maybe that's the problem
 
10:52 PM
@DaveRandom and because this is allowed, I'd like to allow my example too.
 
Maybe the real issue is that optional args don't belong in interfaces
 
interface a { function b ($x, $y); } class c { function b () { return 1; } } should just work as well.
 
@bwoebi disagree there
 
me too
The problem is there is (was) no way to say "I'm implementing this as varargs"
In 5.6+ it won't be an issue
But the implementor must accept the args regardless of whether it uses them because they are part of the iface
 
I'm out, late
 
10:55 PM
@DaveRandom so, I always just should append ...$devnull to the functions when I don't care about the other parameters?
That makes no sense either.
@DaveRandom It accepts them basically, just discards them silently.
 
@bwoebi Interface is a contract. Not accepting args is violation of that contract. The fact that the engine allows it does not make it make sense in code
 
Oy, anyone here live in Italy/Switzerland?
 
Wes (who is prob in HTML/CSS) is in Italy afaik
Oh he's Obi Wan Wesabi these days apparently
and seems to not be there
 

« first day (1383 days earlier)      last day (3565 days later) »