« first day (1010 days earlier)      last day (3938 days later) » 

4:05 PM
@Danack What on earth is that?
 
The best PC game of 1992.
 
Ah, I was four then, only just got my hands on the Atari 1024ST a year or two later
 
hmmm... how to sort an iterator
 
the short answer is, "it depends"
 
4:13 PM
No, I don't want to flatten it first
basically: what I want isn't generally possible...
 
what do you want to do?
 
sort an iterator dynamically on-demand
which is sort-of possible with merge iterators, but it still requires creating a craptastic load of iterators (n log n iterators)
 
the best way to do that is to not do that at all
 
and it requires iterating over the entire iterator once to determine how many merge iterators it needs
 
if you can, get the underlying data already sorted
 
4:16 PM
unless the wrapped iterator implements Countable, in which case it's pretty easy to do...
 
on-the-fly insertion sort? :) or does the result also need to be iterated immediately? :)
 
maybe I'm misunderstanding one or more of "an iterator", "dynamically", and "on-demand"
 
@ircmaxell if you need to iterate over it once before you can iterate it in a sorted way you can just as well just use a sorting callback or iterate it into into a heap to sort it there and then iterate that
 
right, or iterator_to_array
 
Sounds to me like he doesn't want to iterate over it all (recursively?)
 
4:19 PM
correct. Not "first" anyway
if it was countable, I could generate the final sorted iterator without iterating once...
 
@Jasper If often happens when I flag, the flag gets denied, and later it is closed by a mod
 
@ircmaxell how would knowing the count help?
 
because then I could build out the tree of Merge iterators using limit iterators to control offset
 
@Mr.Alien that doesn't mark your flag as "useful-after-all", does it?
 
@salathe you're british, you know it always helps to know royalty/nobility
 
4:22 PM
Hiya
Anyone know a good library for data structures?
 
@Hamster apart from spl?
 
so the first item you iterate over would require iterating every single possible iterator value, but it would be a delayed iteration until that point
 
@Gordon Hmm, this doesn't have things like skip lists and some trees does it?
 
@Hamster why do you want a skip list?
 
@Hamster spl does not have skip lists
 
4:28 PM
Good morning/afternoon/evening, all. :)
 
Hello.
I just started learning PHP, I was wondering if there was a way to make echo permanent. i.e. It updates the HTML file and other site visitors see the updated site.
Any answers/tips/advice appreciated! (This is a chat room :P)
 
@william44isme wut?
 
lol
 
@ircmaxell In my code I have a plot of arbitrary data points (x) and I need a method to get the point nearest a given input point value.
 
4:30 PM
Let me rephrase.
 
lol
 
...
Basically
 
@william44isme yes please :)
 
@Hamster what format are the data points? x? x,y? x,y,z?
 
4:31 PM
Umm
Well let's say that you use echo to display a PhP variable.
And then the variable changes
 
Then when the page is refreshed, the change will be there
 
Yeah
But
Is there a way to make it not change
So it's permanent
 
@ircmaxell Well for their applied use they're points in time (like timestamps).
 
@ircmaxell Sorting PHP iterators is crazy ^^ In C++ sort requires a random access iterator, which is imho the only thing that makes sense
 
That's what I was asking about
 
4:32 PM
@william44isme You want something to "not change", yet the change will be permanent. Which one is it?
 
@william44isme no. that's not how it works.
 
I understand, but is there a way to do that.
 
@Hamster Why not use a binary search for that?
 
@william44isme You should look at writing the data to a separate file and then loading it in subsequent requests - php.net/manual/en/function.fwrite.php
 
@william44isme In response to your first question, read in the contents of the html file using file_get_contents, then make any changes, then write it back to the file using file_put_contents? Then any future users will see the updated html file
 
4:34 PM
@NikiC I didn't say it wasn't crazy
 
Oka
okay*
I'll look at all that, thanks.
 
@Hamster if they are single values would just sorting the list and checking the proximity of either neighbor work?
 
@william44isme when a user opens a php page in a browser, the browser will send an HTTP request to the webserver. The webserver will then create the page from the PHP code on the server. Then it will send the created page to the browser in an HTTP response. The browser then runs/interprets the page, e.g. renders the HTML and runs the JS and stuff.
 
@NikiC *It needs to handle inserts well, be ordered, etc.
@Orangepill ^
 
Anonymous
@HamZa sup!! me is money-less this week. I will log in to keep my consecutive days alive only ;)
 
4:36 PM
@Hamster so you want some kind of bst?
 
im a nub
 
@william44isme that's okay
 
@Simon_eQ fine but tired a bit ! And you ? And what about money-less ? do you need any help?
 
@Hamster Honestly, I would use a different system for that. Push it off on a database or something like that. Doing it in PHP is going to be 1. Slow, and 2. Innefficient since you need to load the entire set into memory every time
 
@NikiC Yeah, if PHP isn't a horrible choice for doing such things
 
4:38 PM
@Hamster Trees in PHP will be pretty (memory-)inefficient, yeah. Whether or not that's an issue depends on how much data you'll have ^^
 
@ircmaxell It essentially is in the database, and I'd thought about making queries to that effect. I just assumed some use of a data structure built in PHP for data that's frequently tread upon would be more efficient than repeat queries
 
@william44isme i'm still not sure I understood what you are trying to do.
 
Anonymous
@HamZa hehe.. nope. I will just check from free wifi spots. for the next 10 days. The good thing is, I get to php more, instead of chatting here all day.
 
@Simon_eQ nice
 
Anonymous
@HamZa are u finally on git?
 
4:41 PM
@Simon_eQ nope
 
Anonymous
its too overrated anyway..
 
@NikiC Most uses probably won't (but can) involve huge trees, but are more likely to involve lots of accessing.
 
@Simon_eQ huh ?
 
Silly question, but does markdown work in here?
 
Anyway, I'm not sure if this falls into the "premature optimization" category, but if there's something close to a 'standard' set of data structures for things like this, I don't see why it should
 
4:43 PM
@DaveMorton yes in a strange way :p
 
Anonymous
@Gordon I was told, that they ' would not ' give me a response before Monday. That Monday was last week. Should I assume, they have went for someone else? I'm too worried.
 
Thanks. I'll try it out in a short while. Umpteen conversations going on, here, in Skype, and in the room. :)
 
@Jasper Nah, it's declined
 
@DaveMorton __bold__ _italic_ ---strip---
 
What about [link title]( URL )?
 
4:45 PM
@DaveMorton it does work :)
 
Awesome! Thanks again. :)
 
13
A: SQL injection can bypass login but not drop table

HamZaAnswering your question mysql_query() doesn't support multiple queries as documented: mysql_query() sends a unique query (multiple queries are not supported) to the currently active database on the server that's associated with the specified link_identifier. Which means that DROP TABLE tem...

 
@Hamster nah, simple repeat queries are going to be likely far better than you'd be able to do in PHP alone anyway
@googleglassmom, San Francisco, CA
Chief Household Officer, MBA, Mormon, Social Media Addict & Google #GlassExplorer. I love life! {Maria}
408 tweets, 153 followers, following 245 users
 
Ok, last question (yeah, right!). Say I have a question posted here that I would like you folks to have a look at. Is there a "proper" way to bring it to everyone's attention?
 
@DaveMorton You can post the link of the question, note that some users may find it disturbing. Also note that bringing attention to your question may have negative effects (downvotes/ closevotes) or positive ...
 
4:53 PM
@Simon_eQ hmm. never been in that situation. If I really wanted that job I'd probably call them or write an eMail. but maybe the others have different experiences with that
 
I'll bear that in mind. :)
 
Anonymous
@Gordon I really, really, really need it. My offer to work for free is still on the table. I don't know why they wouldn't want that. If you think, it can make a difference and is not too much to ask, I would really appreciate it, if you can do anything to convince someone there to give me a chance.
 
Anonymous
My mind is like wandering, if I should write and ask, whether they found someone else or not. But since it took them last time 2 months to call me in, for an interview... I'm trying to remain positive about this.
 
Anonymous
damnn. I must be the first person ever to have asked to work for free, and got refused..
 
@Simon_eQ I don't think I know anyone in the Zurich team well enough to make a difference.
 
5:03 PM
@LeviMorrison: ping
 
@ircmaxell Hello.
 
how's it going?
I'm digging through Ardent for some purposes, and I was curious on a few things... Principly the mutator methods that are everywhere (apply() mutation the vector, instead of returning a new one)
 
@Simon_eQ and the person I know there is from the Bern team but he's just a dev so even if I would ask I doubt he could achieve anything for you there.
 
@ircmaxell Link?
 
Anonymous
@Gordon You'r right, and I forgot these guys are in Lausanne, I don't think, you may know anyone here. Well, it was worth a try anyway.
 
user895378
Here comes the "be functional and immutable" tirade ... :)
 
@ircmaxell I believe that only exists on Vector (and maybe a handful of others).
 
@Simon_eQ sorry. but like I said, if you are curious show initiative and call them
 
hmm, interesting
 
There is map that will return a new iterator with the mapped stuff. See Collection.
 
5:07 PM
I'm (for S&G value) extending Vector to a read-only tuple...
 
Ok, I have time now that most of the other distractions have abated. I posted this question several days ago, and while it has symptoms that are similar to other questions of the same sort that have been posted on SO before, none of the accepted answers for those other posts have worked for me. Plus, it seems to be a very specific problem, as outlined in my question.
Sorry about the "novel" there. :)
 
@ircmaxell S&G?
 
@NikiC Seek & Gestroy
 
@NikiC Shits and Giggles
 
user895378
@DaveMorton Can you put into a sentence what it is you're trying to do?
 
Anonymous
5:10 PM
@Gordon I want too, but I don't want too sound compulsive. I was told, they would 'reply back' to me. I will just send them an email tomorrow.
 
user895378
4 mins ago, by rdlowrey
Here comes the "be functional and immutable" tirade ... :)
 
user895378
> Principly the mutator methods that are everywhere
 
@Simon_eQ I dont know whats the appropriate wait time for calling them. like I said: i never was in that position. the only time I called someone to inquire about an application was when I applied for university. that worked out.
 
@rdlowrey no, I was just curious where there were mutators on there that didn't even have the option of returning a new instance...
 
@rdlowrey I'm trying to retrieve a programmatically generated XML document using cURL that is then parsed and displayed to the user.
 
user895378
5:12 PM
@DaveMorton And which part of the process is giving you trouble? Retrieving the XML, parsing the XML or displaying the results to your user?
 
user895378
@ircmaxell ;)
 
I thought I was very detailed and specific in my posted question. Sorry. :) Let me see if I can explain here.
 
@ircmaxell I obviously haven't worked on documenting things very well :)
 
@DaveMorton you know you don't need curl to retrieve xml documents, do you? DOM and XMLReader can do that on their own
 
5:13 PM
@LeviMorrison you haven't?
 
Nope; just some very basic PHP doc stuff.
 
user895378
@DaveMorton TL;DR ... I'm not Most people are not going to wade through something that rambling. You need to narrow your question to the specific problem. A wall of text and code that describes your entire program isn't conducive to problem solving.
 
@Gordon Hmmmmm... I hadn't thought of that, to be completely honest. :) I'll have to try that. :)
 
http://hasin.me/2013/07/22/robo-an-onepage-wordpress-template-for-free/
Planet PHP
Robo – An onepage WordPress template for free
Hasin Hayder
1374511680
 
Also, can I please correct your reduce() implementations to make the initial optional, and then use the first iterated element if it's not specified?
s/correct/change/
 
Anonymous
5:15 PM
@Gordon ok, ok, we get you are a freelancer :p thanks anyway :)
 
@Feeds who is hasin hayder and why is he on planet php?
 
user895378
@Feeds Wait, people still make WordPress templates?
 
@rdlowrey Thanks. I was just trying to be thorough, seeing as several dozen other issues of the same sort failed to produce a viable solution.
 
user895378
@DaveMorton So, which is your problem? Retrieving, parsing or presenting?
 
@ircmaxell Maybe. I made that decision quite a long time ago. I can't remember why I opted not to do it that way off the top of my head.
 
5:16 PM
Would allow for this
function join($separator) {
    return $this->reduce('', function($result, $value) use ($separator) {
        static $first = true;
        if (!$first) {
            return $result . $separator . $value;
        }
        $first = false;
        return (string) $value;
    });
}
to become this:
function join($separator) {
    return $this->reduce(function($result, $value) use ($separator) {
        return $result . $separator . $value;
    });
}
 
curl_exec() hangs until I reset the Apache server. No PHP timeout at all. Adding the cURL timeout options prevents it from hanging, but returns no data.
 
user895378
@DaveMorton Step 1: verify that you can load the resource in a browser.
 
@LeviMorrison fair enough...
 
@rdlowrey Verified. Pasting the URL in a browser gives me the XML document.
 
user895378
@DaveMorton what happens when you do echo file_get_contents($resourceUri); ?
 
5:20 PM
allow_url_fopen is disabled on many servers, so this isn't an option.
This code has to run on as many OS/Server configurations as possible.
 
user895378
@DaveMorton In that case, do you have php 5.4?
 
user895378
(hint: you should, because 5.3 is nearing end of life)
 
The OS/Server/PHP config that hangs is Windows 8/Apache 2.4.2(I think)/PHP 5.5 with libcurl version 7.30.1
 
@ircmaxell What the static?
 
you've never seen that before?
 
user895378
5:24 PM
@DaveMorton Then you should probably be using this instead.
 
user895378
$client = new Artax\Client;
$response = $client->request('http://somesite.com/myxml.php');
$myXml = $response->getBody();
 
user895378
The end.
 
How large is the class (e.g. number of files, total size of all files)?
 
@ircmaxell Don't think so. Interesting trick, but you can accomplish the same thing without static. It would be just as complex (if not more).
 
right, by passing in a reference closure binding
 
5:26 PM
I really don't like static, and it's not just some phobia; I spend my time working in parallel environments.
 
it's not static globally
just for that function instance
so every call to join will generate a new static value for that subsequent run
 
user895378
@DaveMorton (1) It's not "a class" and (2) If you think that actually matters then I probably can't help you :)
 
@DaveMorton why are you using "windows 8" and "server" in the same sentence ?
 
I ask because I'm trying to streamline and optimize the code involved, so adding anoither class structure to the script will need to provide real advantages in order to justify inclusion.
 
user895378
@DaveMorton I download thousands of http resources per minute with it -- that's my job. If my library is your bottleneck then congratulations.
 
5:28 PM
@ircmaxell I guess I don't see much of an advantage over this: github.com/morrisonlevi/Ardent/blob/master/src/Ardent/Iterator/…
 
Oh, for teh actual join code. Sure. That's fine. I won't argue there
 
@tereško lol because that's one of a number of "servers" that I'm testing my script with, and it's the OS that my dev server runs on.
 
function join($separator) {
    $first = true;
    return $this->reduce('', function($result, $value) use ($separator, &$first) {
        if (!$first) {
            return $result . $separator . $value;
        }
        $first = false;
        return (string) $value;
    });
}
 
user895378
@DaveMorton Lines of Code is in no way correlated to performance.
 
I was referring to this
 
5:29 PM
@DaveMorton hint: one does not simply use win8 as a server
 
@rdlowrey You're right there, and I meant no offense, and I certainly wasn't implying that your product would be a "bottleneck".
 
user895378
@DaveMorton I know you weren't, but I'm suggesting that you're already murdering your performance by retrieving XML dynamically on every page load from an HTTP source. That's a terrible idea.
 
@HamZa Why do I suddenly feel like I'm about to enter Mordor?
 
user895378
(if you're concerned about performance, I mean)
 
user895378
But do as you like, I have code to write. Good luck :)
 
5:32 PM
@rdlowrey I'm not concerned about performance, really. Just about it working. :)
 
in JavaScript, 2 mins ago, by Neal
Well we are looking for C++ Devs in NYC. I am sure I can send out the requirements if anyone is interested.
 
Ok, I'm a dummy. I should have thought of this before, but I can load the XML directly from a URL when I create a new SimpleXMLElement object.
 
@DaveMorton I think that relies on fopen wrappers being enabled.... I think it will fail on environments that file_get_contents wouldn't work.
 
@Orangepill Yeah, I just noticed that myself. {sigh!} back to the drawing board. :(
 
lmfao
10 > 9. You're welcome. — Sylvain 1 min ago
 
user895378
5:47 PM
@DaveMorton You know, I've already linked you to a damn ferarri and you're still looking for a bicycle ...
 
@rdlowrey Given that the script I'm working on is open source, I have no control over what PHP version is used, other than to set a minimum requirement level. Since we want this script to be as widely usable as possible, we've set the minimum requirements at 5.2 - Since your solution requires 5.4, we can't implement it, Ferrari or no.
 
user895378
lol
 
Evening!
 
Right now, I have a bicycle with a bent front wheel. All I want to do at this point is fix that wheel. :)
 
@DaveMorton Don't re-invent the wheel
 
5:50 PM
@Jimbo Trying desperately not to.
 
:D
 
6:02 PM
@LeviMorrison maybe to account for the case of an empty structure?
 
@NikiC probably
 
@NikiC reducing an empty structure without an initial value would be an exception
 
@rdlowrey You up for some super secret awesomeness?
 
user895378
Yes.
 
7:10 PM
jo room 11 bitches!
@tereško pensionado...
 
hola guys :)
 
jo
 
shhh... everyone is sleeping
 
just released meh site hah
 
wth
Ummmm So pick yes or no? — Neal 16 secs ago
 
7:20 PM
@Neal just wow
 
@PeeHaa yea....
RTFM (Read The F* Message) :p — GolezTrol 1 min ago
LOL
 
@PeeHaa Haha it's the same guy lol
289 Questions!
 
if my PHP script is running from the terminal (24/7), is it a good idea to cache prepare statements?
 
@DaveChen might cause an issue if there is ddl queries being done....
 
pastebin.com/xQHxbf3s <- snippet of my class, lines 39 and 42
 
@DaveChen eeeew? Hard coded dependency on the local machine?
 
uhh yes :) I might make it $settings['host'] but yeah localhost only
 
Also why do you need to create a wrapper for prepared stataments?
 
7:33 PM
I can run code like this:
$user = $this->database->selectRow(
            "db_users",
            array(
                "username"
            ),
            array(
                "id" => $user->getID()
            )
        );
 
@DaveChen and how is that better than... idunno. plain SQL :P
 
would plain SQL require me to prepare it?
 
@DaveChen no it wouldn't require you to do it. common sense does
 
I think the above code makes more sense, (#1 = tablename, #2 = what you would like to select, #3 = wheres in the database), it takes care of preparing so I don't need to worry about that
 
@DaveChen What does a join look like?
 
7:36 PM
I have another function for that too :P
some aren't using prepared though, just ->real_escape_string which is ugly
 
So you have basically created a square wheel when you have a somewhat round wheel already at your disposal?
 
better than nothing right? xD
 
Better than nothing (but maybe not, because you might have introduced screw ups). But not better than mysqli->prepare()
 
but then I would need to bind_param, bind_result (I don't have mysqlnd), then execute...
 
Hey. It was your own choice sssss, 'to', 'use', 'a', 'crap', 'api')
;-)
 
7:41 PM
haha yeah I know I could just throw it all away and use PDO
 
Do you get tag score for accepts or just upvotes?
 
@PeeHaa love the comment on that one
 
Anyone wanna make fun of my code today? github.com/maniator/SmallFry/tree/master/lib
 
7:48 PM
@Orangepill ;-)
@Neal Neh thanks. I have just eaten ;)
 
Boooo
 
:P
 
:-P PFFFT
 
tbh I stopped reading after $SESSION
 
@PeeHaa o rly? and why is that?
 
7:49 PM
STOP YELLING AT YOUR TEXT EDITOR. WHAT DID (S)HE DO TO YOU?
Also by the looks of it you are trying to do work in your ctor
 
hmmn
appears i wont be able to get any actual news this week now
 
@PeeHaa ctor?
 
sorry, constructor
 
@PeeHaa baaah. I like yelling sometimes
@PeeHaa ahh
 
:-)
@Neal At least you are using spaces instead of tabs so that is nice :)
 
@SomeKittens lol. That is useful!
 
Good evening
 
Jo @MadaraUchiha
 
!!/xkcd
 
7:57 PM
@PeeHaa YAY :-)
 
:-)
 
MGE
I have:
SELECT * FROM playlist WHERE duration=0
 
3 messages moved to bin
 
MGE
and its taking 0.xx values
how can I take 0 values records only?
 
how can I declare a static class method as abstract?
^ PHP class noob question. HELP!!!!!
 
@hakre you throw an ultimatum at it
 
8:16 PM
@Ocramius ASAP :D
No it's just I encountered this the first time
 
@hakre something like "BE MORE ABSTRACT!"
my teacher at school used to tell me that
 
with objects it's fatal error'ing, but the static "just works" (da fuq)
 
so I guess it works also on class properties
 
well, it's to blame @ircmaxell anyway for that.
so much statics that you get sick
I know the workaround, learned it from ZF 1
 
what?
 
8:25 PM
@ircmaxell public static function detect($hash)
 
what am I to blame for what now?
 
but anyway, that's not saying much, you'll see that later.
you've got tons of code-duplication between SHA512 / SHA256
 
/me hasn't refactored that yet
 
I just do
 
@hakre that is the workarround....
 
@Orangepill which workaround?
@Orangepill and don't answer so many shitty questions :D link the dupes, it's worth it :D
 
@hakre how can I declare a static class method as abstract?
 
@Orangepill well you can't. PHP does not support such a concept.
 
@hakre that's what I thought ... was confused on the ZF1 comment
 
8:31 PM
@Orangepill in ZF1 you can find some kind of pattern: Abstract base class that is calling "impl" functions you can extend.
 
@hakre sure it does. It's just an E_STRICT violation
for some really weird reason
actually, I'm going to bring that up on list at some point
 
well, I'm not yet booked. First smell in my nose was because it's only "violated" since static:: so PHP 5.3. so LSB might just have "forgotten" to introduce some checks here.
 
huh?
 
I have created an abstract base class extending from Crypt for SHA256 / SHA512
And then I moved in everything that's possible in refactoring.
 
ummm...
 
8:34 PM
Including the static method for detect()
and then it turned out the factory tests called $impl::detect()
reculting in SHA::detect() even SHA is abstract (!!).
 
yes, as designed
 
bug, feature or all ok?
 
don't put any abstract classes in that folder. It'll pick it up
 
that's not my issue, I can work around that.
was more concerned in a more general sense.
should PHP call static methods on abstract classes or not?
 
yes it should
 
8:37 PM
I personally was suprised it did. can you tell why it should?
 
because that's one way to prevent instantiation of a utility class with static methods
 
ah yes, right
make the utility class abstract.
even used that, lol ^^
too much wine probably.
 
lol
 
In your opinion how close does a question have to be to another question to be marked as a dup.
I think about 1/4 of my rep has come from answering variations of the I can't get relative paths to resolve question. Solution is the same but context is different in many cases.
 
@ircmaxell I feel like reducing an empty structure is quite a standard operation and not exceptional
That's why I personally think the approach with an initial value is better
 
8:42 PM
@NikiC unless you don't specify an initial value, in which case it needs to use the first one (which is non-existant)
 
@Orangepill if you read the question and you remember either: I answered that once (uber clear dupe) or I know this must have been answered (and you dig it up with a search within 1-3 minutes) you can savely close it a s a dupe.
suggest it here with cv-pls if you want to get that reviewed quickly.
 
@NikiC agree.
 
@ircmaxell Yeah, I'm just arguing why I don't like the "no initial value" approach :)
 
but it makes calling logic MUCH easier for certain values
but wahtever
 
mhm… I just had decided to publish this… github.com/bwoebi/http-websocket maybe you might have some feedback for me…?
 
8:44 PM
@PeeHaa ^^^^^
 
Also, from a theoretical pov (op, neutral) seems quite appealing being a monoid [assuming associativity, which is usually given]
 
@NikiC as long as both are supported, it's fine imo. both are valid cases, and there are valid reasons to want to use either.
 
8:57 PM
@LeviMorrison: Let me know if you have any wishes / needs for Hardware / Books / Your Kitchend or Kids or whatever. The new Design is getting great, just wanna say thanks.
 
I wrote a meta question asking "what is the current policy on <X>". what's the correct thick-bordered tag for that?
 
abends
 
I also like the new PHP logo without the oval in the back :D
 

« first day (1010 days earlier)      last day (3938 days later) »