« first day (819 days earlier)      last day (4129 days later) » 

12:00 AM
@DaveRandom, "same diff?" Yeah. That's a good one, really. I mean, what is the same difference? Wouldn't that actually require four items, in which you compare two sets and determine the difference between each item in the pair is identical to the other pair?
See? This is why I don't write.
I swear, English IS my first language.
I think the real problem is that Perl is my second.
And man, when you start thinking in Perl, there's no going back.
 
@Happyninja SEO is a way for dishonest web developers who probably aren't very good at writing real code to milk money from non-tech-savvy site owners. It's a really nasty business, I've worked with/around a few SEO companies and they were all, without exception, thoroughly nasty and quite dishonest business models.
 
I still miss unless.
 
@Charles wat
 
@DaveRandom Perl has unless, a negative if.
 
I don't know Perl but that sounds like a really odd keyword for a programming language
 
12:02 AM
unless($condition) { foo(); }
You can also write conditionals on the right.
 
What the hell is wrong with ! ?
 
 foo() unless($bar);
 
@Charles That would be annoying in a set of plain English instructions, let alone in code.
 
I really confused a few people by writing a few slightly-over-80-char long lines of code that had right-side unlessses.
@DaveRandom Welcome to Perl.
 
Imagine if Ikea instruction booklets told you what to do for 9 pages and then said "unless you want to put it on the wall, then do the next 9 pages instead"
@Charles lol
 
12:04 AM
@DaveRandom I dare Ikea to come up with an "unless" pictogram.
 
@DaveRandom but it's so much more natural and readable!
 
Jesus, I forgot how much I hate this code.
die &Template("$vars_wordlets_criterr{get_thread_data_baddie} ($forum,$topic)\n" . &Tracer, { FORUM => $forum, TOPIC => $topic}) unless $topic =~ m/^(\d{4})(\d{2})$/;
die(...) unless(...) makes my head want to explode far, far more than, say, mysql_query() or die()
 
@Charles oh, perl!
 
I kind of get it for a very sugary and unnecessary alternative to if (! but the RHS thing melts my brain.
 
agree, I already get issues with unless tbh
 
12:07 AM
@DaveRandom It's amazing in loops. Compare:
 if(!$condition) continue;
 next unless $condition;
I really, really miss it. A lot.
 
$filtered = array_filter($ary, 'the_func');
 
I rarely do either, most of the time I just wrap the body in if ($condition) {}. Obviously that has limits though, I'm not going to write code indented off the side of the screen, but I rarely find myself in that kind of situation tbh. Past about 3 levels indentation in a routine, you probably need to break it up a bit.
 
Digging around in the old codebase now, trying to find one chunk of horrors...
 
@Charles I just noticed get_thread_data_baddie - you write baddies into your code? Do you write goodies in as well? Who wins more often?
 
12:13 AM
@DaveRandom I can assure you that there were no goodies whatsoever in that hash.
 
Just a note to everyone in here who is not a regular: never run a piece of Javascript that @ShaquinTrifonoff gives until you know precisely what every single line of it does. He will make you do things you didn't want to do. And we will laugh at you.
 
@DaveRandom So even in the worst bowels of this horrible decade old perl code, I never had any indents deeper than four. Phew.
Just some very long lines.
 
guys I keep getting T_STRING error what is the problem with this code? anybody has any idea?
$db->query(insert into Sublist(scheduled_date, customer_name, status, kaspersky_template)
values ('$kaspersky[0]','$customer_name','$yes','$kaspersky_temp');
 
@Extelliqent There are no quotes around the query
 
@Extelliqent Do you use a syntax-highliting editor?
 
12:17 AM
nope.. I use notepad++
 
Notepad++ does syntax highliting.
Under the file type menu, go P => PHP
 
@Charles I don't worry too much about long(ish) lines, I certainly don't worry about 80 char limit, I have two 1200x1920 screens running, as do most other professional devs these days (just remembered I am not paid to be a dev :S ). Writing code so it fits in a terminal is just ridiculous, it leaves my screen 2/3 empty when I'm writing in a real env.
 
Thanks!
 
@DaveRandom Yeah, we just use it as a guideline now. Longer lines of code, at least in PHP, are usually a bad sign, for readability if not maintainability.
 
@Extelliqent Oh, and BTW, is that PDO? Because if it is, you are using it wrong...
 
12:19 AM
I don't know how JavaPeopleThatDoThisThingAllTheTime work.
 
what is PDO?
I am doing php query
$db->query("insert into Sublist(scheduled_date, customer_name, status, kaspersky_template) values ('$kaspersky[0]','$customer_name','$yes','$kaspersky_temp'");
 
@Charles Oh yeh I mean obviously you don't want insanely long bits of logic, but I still occasionally see people breaking up string literals to multiple lines with concats just to keep the width down, when the content of the string has no bearing on the program so it doesn't contribute to readability
 
now it's not giving any error, but it's not saving it either.. ahh!
 
 sub illegal_name_check_core {    # TODO - make this routine more sane
/sob
It's like a "I HATE YOU" note from the past.
@DaveRandom Yeah, fair point
You know the other thing I miss about Perl? the q and qq operators.
 print qq~I'm inside a "double quoted" string, with $interoplation~;
 print q^And I'm inside a single quoted string^;
To hell with escaping, let's just change the quote character instead!
 
lolwut
 
12:28 AM
do you guys have any idea why this is not working?
$db->query("insert into Sublist(scheduled_date, customer_name, status, kaspersky_template) values ('$kaspersky[0]','$customer_name','$yes','$kaspersky_temp'");
 
@Extelliqent What error message are you receiving? You should be seeing an SQL syntax error.
 
there is no sql syntax error coming up on the page, its empty
 
@Extelliqent Crank error reporting up, check the error log and/or turn display errors on?
 
php errors are coming up, but sql ones.. error log is empty
 
Well there 100% definitely is a syntax error in that query, you need to echo $db->error();
I think
Don't know MySQLi API very well
1 sec
 
12:34 AM
@LeviMorrison I might look at them ^^ Sounds interesting
evning
 
No it's a property not a method, echo $db->error;
 
@NikiC It's difficult to tell what some of the stuff is doing. I have made little progress.
I'm primarily interested in regular expressions at this point.
That and string functions.
 
I just figured that I forgot couple brackets lol Thanks guys!
 
@LeviMorrison If you could compile so that it is possible to parse HTML with regex I would be most grateful.
 
@DaveRandom :) Not a chance.
 
12:41 AM
@LeviMorrison though don't forget that pcre is an external library
so if you want to improve stuff there you should submit it against pcre
 
@NikiC Thanks. I think I'm going to focus on strings for now anyway.
Since I am not making much headway with regex :)
 
@LeviMorrison Yeah, I wouldn't start with regex either. Those are a lot more complicated ^^
 
@NikiC I voted against it BUT I think array_filter needs to pass the index information.
Currently you can't filter based on key/index.
 
@NikiC Wut? I thougth that has been off the table for a long time
 
@PeeHaa 5.5 is close, now is the time to quickly push in ALL THE RFCS!
Guilty of that myself :P
 
12:49 AM
:)
Well I still fail to see the usefulness...
 
I've had uses for pluck a few times in the past. :-/
 
:P
 
@PeeHaa Then vote -1 :P
@igorw "Voting no, because - even though I like this feature in principle - I think it's much better solved by introducing list comprehensions (which cover this and many more cases in a consistent and elegant syntax), which is something I have planned for 5.6." That's my stance on it ;)
I think for me the solution to all problems in PHP is "introduce list comprehensions" :D
It's the solution to array_column(), it's the solution to your currying, it's the solution to the short-lambda suggestions that I've been getting, it's the solution to EVERYTHING
 
No that would be 42
 
@PeeHaa Maybe they are the same?
 
12:52 AM
@NikiC yeah, it seems to be. I agree that it solves many of the use cases but a) it's not done yet; and b) list comprehensions don't work for callback functions.
 
@igorw a) is not an argument for me.
I don't like this approach where you first introduce a half-baked/shitty/unnecessary feature only because the proper solution is not yet there ^^
That's also why I absolutely hate Stas' argument skipping proposal - I think it's just a shitty workaround for the lack of named args :)
 
i'm just going to go hug my array_change_key_case for a bit
 
@NikiC @PeeHaa var_dump(strlen('Will list comprehensions fix PHP problems?')); // int(42)
 
@DaveRandom (regarding SEO) all of this is pretty new to me and my superior talked about that for a certain time now, but now I think i do understand better what it reallly mean: it's just a way to pump up the price of a contract. I'm curious and I have read many papers regarding this and, well, I didn't understand how it could be considered technical because it much more sounded like blob term.
 
@igorw :D
@igorw I think I actually used that function (exactly once)
 
12:58 AM
I am SEO master and webscale expert, you can talk to me.
 
The @webarto Cake Is A Lie
(be nice please, don't troll too much)
 
@NikiC I think list comprehensions would adress my array_pluck use cases. but not all of the currying ones. :)
 
@igorw I'm okay with that. After all, I can't solve all of your problems, can I? :P
 
so I'll give you this one. ;-p
 
1:04 AM
I mean, if you don't have to work around language limitations all the time, wouldn't programming be oh-so boring?
 
Man, ZipArchive sucks balls. Y U NO WRK WITHOUT FILE IN FILESYSTEM?
 
@NikiC apparently I'm maintaining a userland library for currying. that works for me. I'm not asking you to solve all my problems -- just maybe acknowledge that list comprehensions are not TheAnswerâ„¢ to every proposed RFC to PHP core. ;-)
 
@igorw I know they aren't ^^
(Though I do still fail to see much use for currying in PHP ^^)
 
what do you mean "passing around functions isn't normal"? I do it all the time!
 
Passing functions around is normal
Currying isn't ^^
I think currying is cool if you already use it all around like in functional languages, but in languages that are not heavily functional I think that it makes the code harder to understand ;)
I mean, doing something like map (+5) ns in Haskell is obviously super awesome, but in PHP it just wouldn't be that way ^^
Also things like function concatentation are super awesome, but again they just don't "fit" in PHP and would make things hard to understand ;)
(I'm a total fan of point-free notation)
 
1:21 AM
maybe :)
this seems pretty cool: github.com/lstrojny/functional-php
 
@igorw yup, maybe :)
maybe is a good conclusion
@igorw And you just reminded me of something I wanted to do...
 
Though that will have to wait til tomorrow, dead tired right now
 
@NikiC I'm more dead than tired.
 
too localized
 
1:27 AM
spent 11 hours today in the lab :/
 
Lab?
 
Yeah, it was a long long fight with the vacuum, but in the end it was defeated :)
 
Evening
 
@ircmaxell bonsoir
 
evnin
 
what's the good word?
 
2:03 AM
bird.
 
I guess that's why I don't watch family guy.
It's "good evening" in french :)
 
2:33 AM
$amd->with(array('twig!test.twig'), function($template) {
    echo $template(array('foo' => 'bar'));
});
    if (!$loaded) {
        $loaded = true;
        $amd->define('raw!Twig_Loader_Filesystem.paths', $amd->config->paths);
        $amd->define('raw!Twig_Loader_Array.templates', array());
        $amd->define('raw!Twig_Environment.options', array());
        $amd->with(array('Twig_Loader_Filesystem', 'Twig_Loader_Array'), function($fs, $array) use ($amd) {
            $amd->alias('Twig_LoaderInterface', 'Twig_Loader_Chain');
            $amd->define('raw!Twig_Loader_Chain.loaders', array(
                $fs, $array
 
@ircmaxell ?
 
Anonymous
  if (!$loaded) {
        $loaded = true;
 
Anonymous
^oxymoron
 
it's a static variable, so repeated calls only setup the environment once
 
@ircmaxell awesome :)
 
2:42 AM
I've got circular dependency checks in there now too
And the cool thing, is it'll automatically resolve dependencies. So it reflects over the constructor, and load by class/interface name, or by ClassName.ParamName if not a type-hinted expression
That's what $amd->alias('Twig_LoaderInterface', 'Twig_Loader_Chain'); does. It says to use the Chain loader any time we see the LoaderInterface required
 
can you override it for a specific service?
Say I have two controllers, each need a DB connection. can I define two connections and inject different instances?
 
Well, yes, by defining a factory for one of the controllers
because by the time it hits the resolver, it forgets the class that's requiring it. On purpose
 
ok, but the definition itself needs to reference the actual instance in that case
 
But that would be interesting... I'll have to think on that
 
that's my main concern with container that resolve by interface name
 
2:47 AM
@igorw No, it can load it... So in that case:
$amd->define('My_Second_Controller', array('My_Different_Param'), function($param) { return new MySecondController($param); });
And it's not designed to load all your classes and interfaces. If you use "nodes" such as in Nested-Set model, it won't resolve it because it'll try to create the nodes to the left and right as the same object (or separate, if you alias it with the new! modifier)
And this is more of an experiment, rather than a solid implementation
 
with new! you can replace the factory with a class name, and it will instantiate it with constructor args?
 
yup
even without it
the difference is new! forces a new construction for every time the dependency is used
where as the class name itself without new would cache the instance
 
3:02 AM
I see. any reason to couple those together? the shared instance and the sugar for instantiation?
 
?
what do you mean?
they are uncoupled. The default is shared, and if you don't want shared, alias to new!
 
oh nevermind. I just re-read your examples. I was confused :)
 
yeah, it's confusing
 
I was thinking of having some sort of syntactic sugar for instantiation to not have to write the factory closure.
 
Oh, you don't need that
$amd->with(array('stdclass'), function($obj) { var_dump($obj); }); will print out an object...
 
3:08 AM
well I was thinking for defining stdclass with other services as constructor args
because that's quite a common case
let me rephrase
 
:D
ok, what I was thinking of is handled by your constructor reflection stuff
 
yeah...
 
sorry, for wasting your time -- let me make it up to you with useful feedback.
the filename for NewModule should be uppercased, it's currently newModule
you may want to consider making twig an optional dependency -- i.e. require-dev and suggest.
 
It is???
shows up as NewModule for me
 
$ git mv lib/RequirePHP/Modules/newModule.php lib/RequirePHP/Modules/NewModule.php
fatal: destination exists, source=lib/RequirePHP/Modules/newModule.php, destination=lib/RequirePHP/Modules/NewModule.php
WTF
I'm on OSX, and a case-sensitive FS
 
yeah, that's git and case insensitive file systems .)
AFAIK HFS+ is not truly case sensitive
 
pushed
 
at least by default, in order to allow old apps to run
 
both are fixed
I'm blown away how easy Promises made dependency resolving. No need to worry about anything short of a simple circular reference (at worst, a tree-level circular reference just will never resolve, no infinte loop or anything)...
 
3:37 AM
yeah, it really surprises me that node.js had promises in early versions and they removed them.
 
yeah...
I love the model...
 
I will preach them to every node.js hero I can find. :)
:thumbsup:
did you base the promise API on anything specific?
 
Mostly on the jQuery implementation
and when() mirrors jQuery.when almost exactly
 
in JS land there is a standardisation effort called Promises/A, which basically just defines $promise->then($fulfillHandler, $rejectHandler, $progressHandler) and chaining: wiki.commonjs.org/wiki/Promises/A
 
yeah, it's understandable
 
3:42 AM
maybe i'm missing something, but how does a promise object make sense in the context of php
 
but I like the simplicity of when(promise1, promise2).then(foo)
@Lusitanian two reasons. First, it enables asynchronous callbacks, which make little sense. But second, it handles complex dependency resolution transparently without the chance for infinite loops in all but the easiest to detect circumstances...
 
Ahh, sounds quite interesting
 
I kind of prefer more explicit naming for combinators, like all or and
 
well, and is out ;-)
 
some other great benefits of promises: they act as a state machine, making sure you only call the callback once.
imo the biggest gain is consistent async error handling.
 
3:46 AM
yeah. And the fact that you don't need to worry about where exactly in the stack it gets resolved. Just that it's resolved...
 
hmm
 
if you've ever worked with node.js for example, you need to do crazy stuff like this:

foo(function (err, result) {
    if (err) {
        // wtf!
    }

    callback(result);
});
here's the equivalent with promises:

return foo().then(
    function (result) { return result; },
    function (err) { /* handle error */ }
);
 
that's quite clean
 
and you will never have to accept a callback argument again. instead you just return promises. :)
 
Added .then() support and just pushed
And the cool thing is that you can chain promises
 
3:50 AM
hey guys
 
`when(foo(), bar()).then(function(result) {}); // only called after both foo and bar are completed
 
promises/a chaining is more like this: foo().then(bar).then(function (result) {});
 
Well, you forgot ()
in two places
 
in one place
fixed
then() returns a new promise that is resolved with the fully resolved return value of the success handler
 
Ahh, because each is a differnet promise
 
3:55 AM
cool stuff, still seems to make more sense in an async environment
 
not sure I care for that. But I can see why...
Acutally, no, it's not the same
in your case bar() is only called after foo() resolves. In mine, they are both executed at the same time, and can be resolved independently
Really useful when loading dependencies async...
fire off a few http requests, and let them all resolve in parellel, then when all are complete, go forth
 
$db
    ->connect()
    ->then(function ($db) {
        return $db->query('SELECT id FROM foo');
    })
    ->then(function ($rows) use ($db) {
        $ids = array_map('intval', array_pluck($rows, 'id')); // see what I did there?
        return $db->query('SELECT * FROM bar WHERE user_id IN %s', formatInQueryIds($ids));
    })
    ->then(function ($rows) {
        var_dump($rows);
    });
 
Yeah, definitely useful there
 
and you are right, they are different. your when is essentially a promise combinator.
 
exactly
I'm going to nuke my promise implementation though for yours...
 
hrm, some oddities. I found an issue in When::all(), doesn't appear to be firing on empty array()... haven't dug into it, but is leading to some hacks
 
can you open a ticket?
 
I'll open a PR if I find the issue
 
although it should resolve with an empty array
 
it could be a red herring, but I was seeing issues passing in an empty array that appeared to be due to not firing...
now that I have it working again, let me finish retrying
yeah, it's working, I had an issue elsewhere
 
4:32 AM
phew, alright
 
one difference is you pass the arguments as a single array, where I used call_user_func_array
meaning I need to do a proxy in one spot
 
yeah, you need to convert the array to call_user_func_array
 
seems easy enough :)
the switch, that is
 
yeah, wasn't too bad
once I got around that argument passing issue, it was simple
 
4:45 AM
interesting, looks like some guy did a promise impl a year ago: github.com/stephaneerard/Promise.php
but only recently put it on packagist
 
saw the SuperClosure class a while ago, but not the impl
and he misspelled instantiate
 
:)
 
and I don't care for that resolve mechanism (the callback on invoking the promise)
 
who needs lambdas when we have create_function?
 
hehehehe
 
4:49 AM
the chaining, i.e. returning promise from a handler?
or you mean __invoke?
 
__invoke
and having the deferred resolving via the constructor passing a callback
 
agreed
 
your implementation is just nice
 
it's really @jsor's work, I cannot take credit. but I agree it's a great implementation, has very good coverage and is even well documented.
 
:-)
 
4:55 AM
btw, since I'm the local composer nazi; you should try to avoid dev-master constraints
 
for production libs, sure. But for play things it's just easier...
 
I have a long-ish rant if you care for details: igor.io/2013/01/07/composer-versioning.html, but the short version is: if possible, try to use at least branch aliases, if not stable versions
in this case I would suggest ~1.0 or ~1.0@dev if you really want the very latest
 
will do
 
I guess it's not such a big deal in this case; but might as well spread the love
 
;-)
 
5:23 AM
0
Q: Changing Height and width of modal dynamically when browser screen resolution changes

Vignesh GopalakrishnanI was working on a jquery simple modal. I am trying to load it- on-load and after some 15 Sec it will close automatically. So what i cannot achieve is if i am setting a width and height to that modal and if the users browser screen resolution changes([ctrl(+)]or[ctrl(-)]) the size of the modal ...

Can any one help me wit this question??
 
5:33 AM
@VigneshGopalakrishnan please check title its php room

JavaScript

Topic: Anything JavaScript, ECMAScript including Node, React, ...
 
hai
<?php

$zip = new ZipArchive;
$res = $zip->open('files.zip');
if ($res === TRUE) {
$zip->extractTo('');
$zip->close();
echo 'ok';
} else {
echo 'failed';
}
?>
how to prevent it from being time out?
anyone?
 
Thankyou. but it iwll take one hour 30 min to watch that vieo.
 
@Sujaysreedhar: use set_time_limit
 
@TheOptometrist i mean it there any better way like a intractive uziiping?
maybe with like a progress bar?
 
search phpclasses then
 
5:50 AM
@TheOptometrist that's generally pretty bad advice.
@Sujaysreedhar you're trying to extract a huge file? have you considered moving that task outside of a web request, and using something like a worker or a cron job?
 
hi is there ?? any joomla developers ??
 
@igorw how? am a starter can you explane?
ok
 
phpclasses is generally bad? @igorw
didn't joomla die and then get buried when wordpress came?
 
@Sujaysreedhar you should try to keep your request cycles short if possible
so if you can avoid having responses take minutes or hours to finish, that's probably a good idea.
 
ya thats what am asking how to split up a job
 
6:04 AM
one way to do that is using cron and/or message queues to send long-running tasks to a background process.
so google "php cron" and "php message queue" to get a better idea
@TheOptometrist yes, phpclasses is generally bad. for one, you need to sign up just to get the files. most of the stuff is outdated, no tests, no easy way to submit bugfixes, often many things crammed into a single class.
 
what am trying to do is download some files from one server to my server..
then zip them all so the user can download the files
how to split this job? @igorw
 
I'd personally try to avoid it. if you're going to use PHP libraries, please search on packagist and github first.
 
user895378
6:24 AM
Inspired by recent php-internals discussion: ...IMHO, NOT having annotations is one of the things PHP gets right. Applications should run off of code, not comments. Using annotations to write programs is one of the biggest steaming piles of enterprise over-engineering in the history of planet earth. Please, can we stop with the "I need annotations in PHP," crap? Please?
 
user895378
Please?
 
joomla developer is there ?
 
user895378
I just think they're a gaping design mistake, and if annotations are the answer then you're fixing the wrong problem. If you need annotations to make code work then your design is poor. Maybe I'm wrong but that's just how I feel about them. I think it's an unnecessary layer of complication that doesn't have a place in well-written code.
 
6:39 AM
the only reason we need annotations is because we don't have macros
yeah, I'm not joining this discussion :)
night :)
 
user895378
@igorw It's okay, I know it's one of those conversations that can go on and on -- I know most people don't agree with me. Not a problem. Have a good one :)
 
I still don't mind annotations for configuration and metadata type things
I dislike some of the things Symfony2 does with them though, like @Secure which really fundamentally changes the behavior of an application
 
user895378
I feel like for configuration and metadata things, though, the current reflection API should be sufficient.
 
it probably is
it's not something that needs to be in core (i believe i said otherwise once but i've certainly changed my mind since then)
 
user895378
That's my feeling -- I think they're fine how they are -- moving them into the core of the language would encourage all the garbage that comes along with it ...
 
6:46 AM
imho the core is too bloated as it is (in some regards)
and too skinny in others
but the 80000000000000 built in functions need to be namespaced and some need to be removed
param orders need to be made consistent etc
 
user895378
Good luck making that happen :)
 
user895378
Sooooo much work.
 
i know
plus it wouldn't happen because of BC breaking issues
 
user895378
It would be really nice if all the native functions were namespaced with `Php` or something.
 
that would be good.
plus, to avoid seriously breaking things
allow use to dump the contents of a namespace into the current namespace
a la c sharp, etc
 
user895378
6:49 AM
Yes, namespaces could stand some serious improvement.
 
use Php; would then import all that crapola and enable older apps to work more easily
yeah the way they're implemented is pretty weird compared to...every other language (with namespaces that i've used)
 
user895378
hehe
 

« first day (819 days earlier)      last day (4129 days later) »