« first day (1479 days earlier)      last day (3485 days later) » 

12:18 AM
Anyone fancy doing all my work for me? I really cba this evening.
 
@DaveRandom hehe
 
@rdlowrey It's probably not an actual issue, but it seems the progress watchers aren't firing correctly for redirects in Artax RC5 - pastebin.com/LnmZmhFv
 
user895378
12:43 AM
@Danack You're using the wrong constants. All the notification constants exist in the Notify "enum" class.
 
crap.
 
user895378
The constants in Progress are only for internal things. Perhaps they should be made private static instead since that could be confusing (as evidenced by this situation).
 
user895378
@Danack I'll change the constants in Progress to private static so no one else makes that mistake.
 
@rdlowrey no possibility to reuse the constants? instead of having the Notify enum?
 
user895378
The Progress "constants" are referencing internal state. They aren't really related.
 
12:47 AM
That'd avoid unnecessary private static for something which clearly should be constant
@rdlowrey yeah, I said reuse.
 
user895378
Because they don't share the same states.
 
user895378
Some are the same but not all.
 
user895378
They're just not the same thing although they're similar.
 
oh okay
 
@rdlowrey Do values 16 and 32 need to be defined, or do they come from somewhere else?
 
user895378
12:50 AM
There is a bitwise & comparison done on the state that should evalute to true for both COMPLETE/ERROR states.
 
user895378
Not sure what you're asking specifically though.
 
@rdlowrey I just updated the function to use the values from the Notify class. The progress monitor function is being passed the values:
Notify::SOCK_PROCURED
Notify::SOCK_DATA_IN
Unknown state 16
Unknown state 32
Which look a lot like the Progress values?
READING_UNKNOWN = 16;
COMPLETE = 32;
 
user895378
I thought you were talking about the Progress values before. No, 16 and 32 do not exist in Notify:
 
user895378
class Notify {
    const SOCK_PROCURED = 1;
    const SOCK_DATA_IN = 2;
    const SOCK_DATA_OUT = 3;
    const REQUEST_SENT = 4;
    const RESPONSE_HEADERS = 5;
    const RESPONSE_BODY_DATA = 6;
    const RESPONSE = 7;
    const REDIRECT = 8;
    const ERROR = -1;
}
 
I've updated the pastie - pastebin.com/LnmZmhFv The progress watcher seems to be being passed those values.
 
1:02 AM
@Danack github.com/amphp/artax/blob/master/lib/Progress.php#L70 seems @rdlowrey did tell you something wrong before and your code initially was correct...
 
I've edited the pastebin - it was using the \Amp\Artax\Progress constants before.
 
user895378
@Danack I'm sorry, I derped and didn't read your original example closely enough.
 
Derping on Sundays is allowed.
 
user895378
Yes, the "request_state" fields in the progress update array should match up to the constants from the Progress class.
 
user895378
And if they don't, then yes, there is something wonky in the Progress code. My apologies.
 
1:18 AM
I'll make an issue - I'm also seeing Artax explode when following a redirect.
 
user895378
@Danack Cool. Sometimes it's easier for me to digest an issue report TBH. Like tonight I'm right in the middle of things and multitasking leads to me not knowing what I'm talking about :)
 
user895378
1:58 AM
@Danack are you having any trouble connecting to api.github.com? Because I can't get anything but a connect timeout when I try to run your test script ...
 
@rdlowrey I was going to ask you about that....but thought it was possibly something I was doing stupid...Yeah - it basically doesn't seem to be accessing it.
Oh - some of them of them are getting responses.
 
user895378
Well as other sites (including github.com) seem to be responding perfectly well there are only a couple of things I can think of ...
 
Are you seeing no responses or just it hanging?
 
user895378
I'm wondering if our respective IPs have been banned given the frequent testing we have been doing :)
 
user895378
The socket connect attempt is timing out. I can't even get a connection to api.github.com
 
2:00 AM
Hmm. What I'm seeing exactly is that some requests are happening okay, but then at some point the requests stop being processed. I'm not seeing a socket time out error.
 
user895378
Okay ... now I'm getting somewhere.
 
user895378
Apparently api.github.com is not even listening on port 80
 
user895378
So when I try to connect to the http:// version of the URI I get a socket connect timeout.
 
Hmm.....did you set a useragent for that test?
 
user895378
I just used telnet.
 
user895378
2:07 AM
telnet api.github.com 80
 
user895378
But port 443 is clearly open.
 
A user agent is required to access api.github.com
api.github.com/repositories/6269013/… - this redirects to https in a browser.
 
user895378
I can't even get a socket connection on port 80, though.
 
user895378
My chrome indicates that the redirect to https is done internally by the browser (it already seems to know from previous browsing that api.github.com uses encryption).
 
user895378
But the default port for http is 80 ... there's no way to know I need to try port 443 in artax if I can't connect on 80 and be redirected.
 
2:13 AM
Fair enough.
 
user895378
When I use the https:// URI in your script everything seems to work fine (it's only doing the one request).
 
user895378
But artax can't even get a connection to port 80 to know it should be redirected to 443
 
user895378
I'm interested in how my chrome knows to try 443 though.
 
You don't see the double Progress::SENDING_REQUEST, Progress::SENDING_REQUEST ?
 
user895378
I do see that, but it's not a mistake -- that's going to be output any time data is written on the socket.
 
user895378
2:17 AM
Wait.
 
user895378
I might be stupid.
 
user895378
Well I'm definitely stupid, but I might be wrong too, I mean.
 
user895378
Okay, now I see what's happening.
 
user895378
The Progress object is notifying the callback with Progress::SENDING_REQUEST both when the socket connection is completed and checked out for the request and also when data is actually written on the socket.
 
user895378
So the question is ...
 
user895378
2:21 AM
@Danack Do Progress callbacks care about the procurement of the socket enough to add another "request_state" notification constant? Or should that event just not be sent to progress callbacks? I'm leaning towards the latter.
 
I guess the only use would be for debugging.
 
user895378
Well I can do either way. It's your call because I don't care.
 
You'd have to either change the current situation because having two sending_request events is confusing. So I guess there's a small amount of benefit to adding another state, even if it's only used in debugging scenarios.
 
user895378
I'm wondering if chrome doesn't try port 443 when it can't connect on port 80 for a given domain name and store that 443 should be used for future requests on a success ...
 
user895378
@Danack Okay, I'm just adding Progress::CONNECTED then.
 
2:27 AM
btw api.github.com is kind of listening on port 80 - it's just returning a [RST, ACK] packet. And presumably Chrome takes that as an indication that a server is here....lets try HTTPS. I wonder if that's for all sites though or just famous ones.
 
user895378
Ah I see. PHP definitely doesn't expose that level of granularity in its socket streams for me to be able to try react in a similar way :)
 
user895378
What I can do to help mitigate this kind of problem though is ...
 
user895378
When the exception you're seeing is going to happen I can check to see if any data at all was written on the socket before the error was detected and suggest trying https:// instead.
 
user895378
@Danack What OS are you testing on that you actually get a connections but then it just errors out?
 
user895378
Because on centos I can't even get a connection established in PHP :/
 
2:31 AM
@rdlowrey I'm on OSX, but that RST, ACK was seen testing through a browser - I can check it's still there from PHP.
 
user895378
It's interesting that in your OSX php the connection is "opened" but is "dead" when you try to use it but in centos the connection just times out.
 
I get the same Syn => RST, ACK from php.
 
user895378
Yeah but I can't access that level of information inside the php script with a tcp socket stream.
 
And in a Centos vagrant box, hosted on OSX I get ''Socket connect timeout exceeded: 30000 ms''
 
user895378
Yeah, that's what i see in my centos.
 
user895378
2:36 AM
Can you do me a favor and modify a file in the vendor/rdlowrey/nbsock/Connector.php and tell me what output you get on your OSX?
 
user895378
$isResource = is_resource($struct->socket) ? 'yes' : 'no';
$isEof = @feof($struct->socket) ? 'yes' : 'no';
printf("--- isResource: %s, isEof: %s\n", $isResource, $isEof);
 
user895378
^ put that at line 185?
 
Just before the succeed?
 
user895378
I want to know if I can tell that the socket connection is dead as soon as it "succeeds"
 
user895378
Yeah.
 
user895378
2:37 AM
And just let me know what the printf outputs.
 
--- isResource: yes, isEof: no
 
user895378
what the f.
 
user895378
var_dump(fwrite($struct->socket, "\n"));
 
user895378
If you add the following what does it output?
 
user895378
(hopefully false and an error message);
 
2:39 AM
int(0)
PHP Notice: fwrite(): send of 1 bytes failed with errno=32 Broken pipe in
False-ish.
 
user895378
good enough.
 
user895378
I mean ... I could add stuff to workaround those instances but it still wouldn't help everywhere because as we've seen some OSs will just timeout on the connection.
 
I think just changing the error message "Socket disconnected prior to write completion" to be something more likely to prompt a check that it's user error rather than an error in the library would be the best improvement.
You're never going to be able to make it magically work, so just leading the user in the right way to fix the bug in their code is the only hope.
 
user895378
Like what though? "Socket disconnected prior to write completion" is the correct message in that scenario. A socket connection was established but was found to be dead before we could write the (full) response.
 
user895378
It's the same error you would get if you were disconnected in the middle of sending a large file.
 
user895378
2:45 AM
The problem is the OS reporting that the connection succeeded when it didn't actually succeed.
 
user895378
I guess I could check if any data has been written successfully on the socket and modify the message if not.
 
I think the two cases probably merit a separate error message. socket disconnected with no bytes written => user error. Socket disconnected with some bytes written succesfully => server error.
 
user895378
Okay, I think you're right ... I can modify that and suggest "you might try https instead ... blah blah blah" if the connection isn't encrypted.
 
Cool....Thanks for investigating - I think I might go to bed now....
 
user895378
FWIW by requiring the sockets extension I could detect the RST,ACK but the point of the library (in-part) is to not need any extensions.
 
user895378
2:48 AM
@Danack Okay, sorry for the initial bad information ... Sundays ya know.
 
user895378
Have a good night. I'll push the progress update and exception message improvements in the morning unless I'm feeling productive and chipper a bit later.
 
6:14 AM
guys, sorry I don't know where to go to so I'll ask here.. what SE site does administration of openx/revive belong to?
 
6:30 AM
0
Q: RC4 PHP cannot decrypt

HarikrishnanI have encrypted strings using rc4 encryption. I could decrypt 1st string I have encrypted. But I couldn't successfully decrypt 2nd string onwards. Any idea? My code $dpl = 256; $file = fopen( 'log', "w"); $key = 'sjhdjhd'; $content1 = rc4($key,str_repeat(" ",$dpl).'ABC'); $content1 = substr($...

 
7:17 AM
good morning
does anyone else has github avatars removed?
only some show up
oh
GitHub's avatars are currently down as we reprocess them all from rounded squares to circles. Hold tight!
 
7:32 AM
morning
actually afternoon
according to my timezone!
 
posted on November 03, 2014 by kbironneau

/* by serviet */

 
allo?
 
allo!!
@Feeds this ticked my nerves!!
 
Oh good. there are people in here! lol whats up
 
7:41 AM
haha. yea, it seems so. :D
 
moin
 
good mornings
 
mornings
 
8:14 AM
good meurning
 
moin
@JoeWatkins we wanted to eventually continue the phpdbg docs?
 
8:37 AM
Dependency management with Composer : goo.gl/Jb6qq9
 
9:00 AM
Morning
 
Morning
Is it against the rules to post a question I just asked to the chat?
 
just post the link to your question, and people who have time will check out your question
 
Thanks @Naruto: stackoverflow.com/questions/26710003/… It's a question about finding the children of the sub-sub-category from a sub-category
 
@theGreenCabbage room-11.github.io/#do_7 rule number 7 ;)
 
Oh cool thanks!
Currently my technical ability only allows me to return the children of the sub-category
And not one level deeper
My recursion is rusty B^(
 
9:07 AM
morningi
 
morning
 
ThW
Morning
 
o/
 
@theGreenCabbage You mean you want to flatten the structure so that you have a single 1D array (?) of all descendents of the given parent?
 
I do want all of the descendents of the given parent, yes
I echo the result as JSON
As for it being a single 1D array, not necessarily
 
9:12 AM
@theGreenCabbage Then it looks like your code should do this, as it's recursive?
 
Indeed, but if $child['children'] has sub-categories that also have children, it would not be returned
Not quite sure how to explain this very well, sorry :x
 
Yeh but you take a parent, get its children, and then treat each of those children as a parent and get its children recursively? Or is there some other dimension to this?
 
Yes
Yes to your first sentence
 
So that seems like it should be doing what you want, then? Do you have some sample data and the output data you are getting vs what you want instead?
 
Yep
I can link you to it
 
9:16 AM
Also, unrelated but fyi, $this->load->model() is a code smell in at least two ways...
 
Here is the formatted JSON output: pastebin.com/6NUTLDtb
As you can see, id 61 and 60 are parents, each with sub-categories
each with children**
 
Hello, what option should i use with pdo fetch() to replicate the mysql_field_seek functionality ?
 
However, these children ALSO have children, and while I treated each of those children as a parent and get its children recursively, the JSON does not show that
 
@theGreenCabbage Out of interest, what happens if you pass, say, 69 in?
i.e. are you sure the subcategories have working subcategories set up? Is it just a data problem?
 
If you pass 69 in, it would show its sub-categories
Yes, the data is not an issue
I have manually taken my queries and plugged them in, so the data is fine 100%
 
9:20 AM
morning
 
Ow wait @theGreenCabbage I know what the problem is
 
@DaveRandom Shoot me
 
moment
for ($i = 0; isset($children[$i]); $i++) {
    $children[$i]['children'] = $this->getChildren(
        $children[$i]['id'],
        $language_id
    );
}
Try that instead of the foreach
 
@PeeHaa yo dawg
 
9:25 AM
Thanks dude!!
 
mr dave o/
 
Morning
 
@theGreenCabbage so (this might make it more obvious what the problem was) you could also have solved it using foreach ($children as &$child) {}
 
Good Morning
@DaveRandom Hello Dave
 
But the for approach will be more memory efficient
@HendryTanaka You're my wife now
/me wonders if anyone will get that reference
 
9:28 AM
Trying out the new inbox for google.
 
@DaveRandom I'm a boy. I want to ask you, do you know about hashtag symbol in URL? What is that?
 
There's stuff everywhere -_-
 
In computer hypertext, a fragment identifier is a short string of characters that refers to a resource that is subordinate to another, primary resource. The primary resource is identified by a Uniform Resource Identifier (URI), and the fragment identifier points to the subordinate resource. The fragment identifier introduced by a hash mark # is the optional last part of a URL for a document. It is typically used to identify a portion of that document. The generic syntax is specified in RFC 3986. The hash mark separator in URIs does not belong to the fragment identifier. == Basics == In UR...
 
@SecondRikudo you can't reopen something in a binding way you've closed with a binding vote?
 
9:29 AM
@HendryTanaka There's nothing wrong with gay marriage. :Ь
 
@bwoebi My guess is that because the question went through a revision wipe (first revision had credentials), the first revision has no tags
 
well… one should have at least that one possibility to quickly retract its binding vote @SecondRikudo …
 
And so mjolnir has failed me.
 
ah okay
 
@Leri I'm not a gay pal
 
9:30 AM
I usually can use Mjolnir to insta reopen dupes
 
@DaveRandom What was your thought process when you were solving this issue?
 
@HendryTanaka That was a joke, tbh.
 
@SecondRikudo $meta->add($postBySecondRikudo);
 
@Leri Never mind
 
posted on November 03, 2014 by kbironneau

/* by comporellon */

 
9:31 AM
@bwoebi Meh, the case is rare enough for not really requiring attention.
 
@DaveRandom I didn't get it. Can you explain in a simple sentence?
 
@SecondRikudo hehe… why fix bugs… they're rare enough… don't care…
:-P
 
@bwoebi I already notified the staff member that wiped the revision, don't feel it needs a meta post
Feel free to open it though
 
@SecondRikudo I already voted on it…
 
@bwoebi I meant the meta post :P
 
9:34 AM
@HendryTanaka Fragment identifies the current section/portion of loaded document in most cases.
 
I cannot repro myself, so no.
 
Hello, what option should i use with pdo fetch() to replicate the mysql_field_seek functionality ?
 
@theGreenCabbage I added an answer to your question - it took me a minute to cotton on to the fact that you were using arrays and not objects
 
@DaveRandom something like $_GET?
 
@HendryTanaka If you put #foo on the end of the URL and you have <div id="foo"> on the page, it means that the browser will load the page and then scroll so that <div id="foo"> is visible on the screen
 
9:37 AM
@Joseph $stmt->fetch($fetch_style, PDO::FETCH_ORI_ABS, $offset) Or maybe choose any other direction. Depends what you actually want.
 
Or does it need anchors? Might need anchors. Can't remember.
 
@DaveRandom nope ids
 
That's roughly it, anyway.
@PeeHaa I know it certainly used to work with <a name="foo"> as well, or maybe it was one of those old-IE-only weird things
 
deprecated
You're old dawg
 
@DaveRandom Thanks dave, I've got it now
 
9:40 AM
yup, 30 in like 9 days
 
@DaveRandom I didn't receive the invitation to get drunk in the UK? ;)
 
@DaveRandom Thanks a lot. Great informative answer.
 
good mornings :)
 
mornig @hakre
 
@theGreenCabbage caveats to the comment I just added which won't fit in comments on main site:
1) it's hard to sanely use a for loop with an associative array. It can be done using array_keys() and other approaches, but it's likely to result in unreadable code
2) If you have a very deep structure to work with, using a for loop can again result in unreadable code very quickly
 
9:45 AM
Don't use for loop until you need to calculate next key. This is the rule I apply when working with arrays.
 
3) while the problem at hand can give you a noticeable efficiency increase by using for instead of foreach without a complexity hit, in general you should write readable code first and concentrate on performance second.
 
In general, performance is not something you should worry about until you actually have a problem
@Leri Also if you find yourself using a by-ref foreach, there's probably a better way. Not always, but probably.
 
@Fabien well that's actually something I always asked myself but only for london city... .
 
@theGreenCabbage note also that I only added the link to the foreach question for completeness, try not to go too far down the rabbit hole in terms of worrying about how stuff like that actually works...
That's my first answer on the main site in 4 months :-/
It's pretty rare that an answerable question in the PHP tag doesn't get answered with the first mins though, and I just don't have the time or energy to trawl through the shite any more
 
9:54 AM
 
mnoring @Jimbo
 
@bwoebi Good spot! Thanks :-)
 
@PeeHaa You are welcome to come and do that whenever, not sure why you'd need an invitation or event? :-P
 
@DaveRandom :D
 
moanin
 
10:01 AM
@tereško LOL, I will add this. Is it too basic or is that a good start?
 
@Jimbo You should probably point of that the actual façade pattern is a legitimate approach in some circumstances, as well
 
@DaveRandom I feel like this would make a good second blog post
?
@DaveRandom What's the legit approach?
Ohh yeah, the actual pattern. Of course.
 
@Jimbo Oh yeh, I just mean one sentence to distinguish between façades are bad! and Laravel weirdo Super::$tatic "façade"s are bad
You could write that second post if you want, but I believe that Taylor is not great at taking criticism...
 
I don't care about some guy with a girl's name and his mental health problems.
Rather educating people on best practice, the reasons behind it, and learning along the way :-)
Well, doesn't that make me a superior b*tard lol :P
 
> 1, 2, 3, 4, I declare a thumb flame war@Jimbo, just now
 
10:12 AM
Got a reply on that blog post:
 
@Jimbo you at phpnw this week?
 
> You might be conflating state and methods. Scala - a popular no-global-state culture still has singleton/static objects.
 
Yeh I don't really know what to make of that
 
But, Scala compiles to Java Byte-code right? It's not really a web language...
 
Java is (can be) just as much of a web language as PHP
It sucks, of course, but it can still be done
 
10:16 AM
Yeah man, I remember when I did Java servlets at uni shudders
But still my point was, Scala is okay to use singletons because it's not a single request / response thing like php is
So that leaves only statics
 
Hey PHP!
 
pce
good morning
/me has an extract method day
 
@Jimbo oic. Well idk enough about how Java servlets actually work to comment on that, but yeh it you're looking at a long-running then it's slightly different (but singletons can still be avoided regardless...) - but it is a valid point that calling a stateless static method isn't global state, it's just tight coupling. It's probably worth distinguishing that somewhere near the top...
 
Ahh, very fair point
> Here's something worth distinguishing before we continue: calling a stateless static method isn't global state, it's just tight coupling. Even though these are to different issues, they're both harmful and avoidable.
^ That okay?
 
10:37 AM
@Jimbo Maybe include a "what is coupling" section as well?
@bwoebi ping?
 
Does anyone have that gif with a female spinning around a field (with some uzi)
 
@RonniSkansing It's from the sound of music :P
 
thanks
 
@RonniSkansing Found it
 
10:57 AM
good moonins
 
morning @salathe!
 

« first day (1479 days earlier)      last day (3485 days later) »