« first day (155 days earlier)      last day (478 days later) » 

00:23
@rdlowrey Howdy.
How're your projects going?
user895378
@LeviMorrison better as of this afternoon.
user895378
I didn't get much done on anything streams/artax related this week because of real work backlog and the residual vacation haze.
user895378
BUT ... after some stagnation on the streams over the last couple of days, things seem to be starting to click now.
That's good.
Sorry about all the backporting you'll have to do.
user895378
eh, non-issue
user895378
00:28
Sadly, I misread the movie times yesterday, so I didn't get to see the Hobbit in 3D ... the regular version was enjoyable, however :)
Well, at least that's good to know.
@rdlowrey I'm glad ircmaxell came back.
His perspective was refreshing.
user895378
@LeviMorrison yeah, no kidding
Helped me clean up a lot of things.
user895378
The more smart people, the better. And he knows a heck of a lot.
I've mainly trimmed things. No more ArrayStack or ArrayQueue. I needed a stack and queue for a project but didn't have anything linked-made yet. So I just made the Array* versions to have something.
Several classes lost the contains method.
Overall I'm happier with it. It's a lighter, healthier library.
user895378
00:38
Lol, look at the Location header I get back from facebook using Artax:
user895378
Location: http://www.facebook.com/unsupportedbrowser
. . . lol
user895378
Actually, I take that back. That's not from Artax. That's a raw SslSocket test.
Aw. I can't visit it in Chrome.
user895378
Artax retrieves it just fine (because Artax normalizes lots of headers to make sure things are Kosher).
00:40
I'm sure they do some kind of detection on that page and redirect supported browsers to their homepage.
user895378
yeah, definitely
user895378
Yep, just adding User-Agent: test smooths things out with the facebook user-agent police
Now adding key to the BinaryTreeIterators. Since trees have no concept of an index I originally avoided them and always returned NULL. However, it can be useful to know which one you are on and people don't like having an extra variable that they increment themselves.
user895378
Sounds good. For a moment I considered using BinaryTree to implement a manual gzip parser to obviate the need for zlib extension. I might eventually do it, but for now I talked myself off the ledge because there are too many other important things to do first.
user895378
Gzip's underlying DEFLATE compression method can be decompressed using a binary tree
user895378
00:54
1. I've said it before, but the Ardent lib is really great, and ...
2. I'm a big fan of the new name
Thanks. :)
The PostOrderIterator is problematic when setting the key.
Mainly because I still don't understand that code.
It's . . . voodoo.
I wish I had commented the PostOrderIterator::next method a bit.
When I manage to figure it out, I'll be adding comments straightway.
user895378
in PHP, Dec 11 at 22:54, by DaveRandom
There is nothing worse than having to reverse engineer your own code.
I feel like this isn't really mine.
Have you looked at it?
A pseudo-recursive nightmare.
Forced on me by a C algorithm I found.
It didn't even work out of the box.
I seem to have a working version now, but I'm not going to pretend that I know why.
Nor will I pretend this is bug-free.
user895378
01:18
hehe I haven't looked at it, but I will try to do so tonight or tomorrow to see if I can be of any help
> WARNING: PostOrderIterator is voodoo magic and probably has bugs. Please open a ticket if you find one!
That's part of the commit message.
And no need to look at it. Streams are way more important.
I'd be very surprised if anyone actually uses the PostOrderIterator. I simply couldn't omit it out of moral obligation to do the right thing.
user895378
01:36
So it looks like the initial streams implementation will not support SSL over UDP datagram sockets. It's extremely seldom used, and I don't currently have the knowledge needed to implement it. It would take me a couple of days to learn what I need to make it happen, so it will just to have to wait.
user895378
That has no impact on normal SSL HTTP transfers, which use TCP sockets.
user895378
The other option is to not include UDP socket support in the streams library at all, because they don't really fit as "streamable."
user895378
UDP is "connectionless" and inherently unreliable -- it's not a steady ordered stream of data like TCP. ircmaxell's advice yesterday seemed to lead to the conclusion that UDP didn't really fit the stream context.
user895378
Currently it works fine, it's just that UDP sockets always return TRUE from the Iterator::valid() method (because there's no connection)
user895378
(and SSL over UDP will bork, but that's not a design problem)
user895378
01:44
All that said, I'm going to keep the UDP functionality for now even if the abstraction is 1% leaky because it just makes non-blocking DNS lookups sooooo easy.
So, if valid always returns true, it never terminates?
You have to break it yourself?
user895378
@LeviMorrison Yeah, that's the point. There's no "start" and "stop" for a UDP socket. It's not really a stream.
user895378
You send out data and then you may or may not get a response (you should, but you can't be sure)
user895378
It seems weird but it can be really useful.
Most "streaming" apps use UDP.
Video/audio, etc.
user895378
01:50
Because UDP basically carries no overhead (as compared to TCP), and the data can arrive in any order (not the order you sent it)
user895378
So it's faster/lighter than TCP
For everything I do the reliably is more important.
user895378
And because there's no guarantee that a packet will arrive, you can't definitively say "this is the end of the stream" ... you could sit there waiting forever.
user895378
I don't know. I may be able to work out a way to have a sensible valid() return, but right now it makes a lot of sense to me just to say, "Don't iterate on valid() for a UDP socket.
But you won't because this is UDP and we don't care if it gets there.
user895378
01:54
true.
user895378
So basically in my DNS lookup tests with the UDP stream the usage just looks like this:
user895378
$sock = new Socket('udp://8.8.8.8:53');
$dnsClient = new DnsClient(['google.com', 'yahoo.com'], $sock);

while (TRUE) {
    $sock->current();
    $sock->next();
    if ($dnsClient->isComplete()) {
        break;
    }
}
user895378
(ignore the ugly OO design for now, I'm just testing things)
lol
Why call current but don't use it?
user895378
@LeviMorrison I am using it ... the temporary DnsClient is listening to the DATA events generated by $sock->current()
user895378
01:59
I just split that out so you could see the loop working
Wouldn't a DNS lookup WANT to be blocking?
I dunno.
user895378
Not if you're retrieving 50 resources from a Client::sendMulti call ...
Well, I meant something like lookupMulti where the whole collection blocks, but not each one.
user895378
Yes, you're right. I will make an actual DnsClient class that works that way as well. I'm just making sure I can do the stuff that's necessary for the Artax usages first.
user895378
The nice thing is that blocking operations are the easy part :)
user895378
02:09
@LeviMorrison Taking a break. May or may not be back for more code later. If I'm not, have a nice evening :)
@rdlowrey I won't be on much longer either. Trying to work out a train schedule to get home.
 
3 hours later…
05:03
posted on December 16, 2012 by noreply

‹prev | My Chain | next› From the very beginning, I have built my Dart web applications the same way that I build my JavaScript applications—with client-side code directly in my web server's public directory. Last night, I finally tried to test my application and found that maybe, just maybe there is a better way of doing this. The solution that I came up with last night was to put my Dart a

 
9 hours later…
13:42
posted on December 16, 2012

Edit a todo.

14:32
Just pushed 6 commits from the train ride home.
I didn't think I'd be so productive without an internet connection.
14:49
@rdlowrey Congrats on nearing 10k.
user895378
@LeviMorrison haha imagine that, not having the internet to distract you resulted in higher productivity.
@rdlowrey Who would have thought? :)
@rdlowrey Are you familiar with the CLI option -E?
user895378
nope.
user895378
so you use it to pass additional code to be evaluated once all input is read?
user895378
Is that correct?
user895378
15:05
user895378
in PHP, Mar 22 at 0:35, by rdlowrey
95% of being a good programmer is not being distracted by the Internet.
echo LinkedListUnset.php | php -B '$start = microtime(true);' -E '$stop = microtime(true); echo $stop-$start;'
^ It works like that.
user895378
Oh nifty
user895378
My insurmountable ignorance never ceases to amaze me.
user895378
There. That's better. It didn't sound right for the first nine edits.
user895378
15:13
I wish I knew how to program when I went to college so I could've written scripts to login and choose courses the second my window became available.
user895378
Never would've been stuck with an 8am class :)
lol
Someone did that for BYU and got a court case out of it.
But the university has a waitlist system now.
user895378
haha, well I wouldn't hammer the server. I'd just automate my choices so I wouldn't have to remember to login and choose really quickly at exactly the moment I was able to do so.
Let me clarify: he built a system for students to use that would register their classes for them.
user895378
hahaha
15:18
Also, rep-whore plug:
1
A: PHP: Call a function at the beginning and end of each file

Levi MorrisonCommand-line: This is pretty awesome: echo <file_to_execute> | php \ -B '$start = microtime(true);' \ -E '$stop = microtime(true); echo $stop-$start;' This uses two options that are hardly used in PHP, -B and -E. The first option lets you specify code that will be run before proces...

I've got to get to 10k eventually.
user895378
Number one rule of possibly nefarious automation: Never share the wealth. Rule number two: do everything in your power to make sure the activity seems like it could possibly be human.
user895378
@LeviMorrison I'm always happy to lend an upvote.
Appreciated.
A question that is a bit off yet promising:
0
Q: creating a client for a chat - PHP

philippeI'm trying to create a PHP chat, so I have server.php that starts the server on the terminal, which is listen to client connections: <?php function chat_leave( $sock, $chat_id = 0 ) { if( $chat_room_id[ $chat_id ] ) { unset( $chat_room_id[ $chat_id ] ); return true; ...

user895378
@LeviMorrison I get annoyed by all the knee-jerk "You can't do sockets with PHP, you should do it with this other thing" reactions ... they're uninformed.
@rdlowrey TAKE YER NODE.JS AND STUFF IT!
3
A: PHP: Call a function at the beginning and end of each file

JackI'd highly recommend checking out Xdebug instead to help you debug your code. Doing this yourself is just going to drive you nuts! Xdebug can do function traces out of the box and much more.

I can't believe this guy is beating me.
user895378
15:35
Yeah, I never understand why people up-vote super-simplistic "link-style" answers over real answers.
Well, I recommend XDebug as well but it doesn't even answer the question.
user895378
When you see ~30k users posting link-only answers, it sheds some light on how they got to 30k
user895378
In my continuing efforts to make UDP streams work sensibly with the iterator interface, Socket::valid will no longer always return TRUE for UDP. But the problem is that you still can't really do while ($stream->valid()) { to iterate over it because valid() will return FALSE on a UDP socket if no data has been received yet.
user895378
So you have to introduce a timeout as well to account for receiving data that doesn't arrive instantaneously on a UDP socket or just use an infinite loop with a break:
user895378
15:41
$timeout = 3;
$timeStart = time();

while ($sock->valid() || (time() - $timeStart) <= $timeout) {
    $sock->current();
    $sock->next();
}
user895378
Or:
user895378
while (TRUE) {
    $sock->current();
    $sock->next();
    // if something then break
}
user895378
Or just use a blocking call (which I haven't yet implemented), but it doesn't really make sense to block on a UDP socket because the data might never arrive and if the data is critical you shouldn't be using UDP in the first place.
user895378
So in summary: The Iterator interface works well for streaming data in from a UDP socket, but you can't rely on Iterator::valid as your loop condition because it will return FALSE any time there is no unread data available at that moment on the UDP socket.
Okay. I'll probably have some questions if I ever end up using it :)
user895378
15:47
The difference in behavior from a normal TCP socket stream as I have it implemented is ...
user895378
A TCP socket will continue to return TRUE on calls to Socket::valid as long as the socket connection is still alive, even if no new data is available.
user895378
@LeviMorrison But like you said, if you ever need to use it, just ask.
I'm going to repost my rep-whore plug tomorrow when Jack has left the room and other regular users are there.
I need more than 20 rep for half an hours work!
user895378
lol, I love that strategy.
user895378
Your answer is actually really helpful. I learned stuff. And useful stuff at that.
user895378
15:50
And I empathize with the feeling of, "my answer and the effort involved is clearly worth more than the rep I've received heretofore"
user895378
I've had to learn to not get too attached to an answer, because rep-earned doesn't always correlate fairly with answer quality/superiority
Sadly, it's true.
I don't want to get too attached but rep-whoring is hard work!
user895378
I feel your pain, sir. It's depressing to put in good work and not be rewarded. The problem is that the prime rep-whoring times are mornings early in the work-week ... Sunday mornings not so much.
user895378
Not nearly as many eyeballs right now.
user895378
@LeviMorrison lol of course the much weaker/simpler ext/mysql answer (by comparison to the other) already has multiple upvotes.
16:00
@rdlowrey Except I knew I'd get upvotes from PHP chat on that one.
user895378
Well, still. It just illustrates the lack of correlation between quality and rep-earned.
I honestly felt a downvote was necessary for the leading answer. It regurgitated information and then summarized it incorrectly.
user895378
Backtracking quickly, I believe my latest changes will have made SSL over UDP work just fine, but that functionality will live in the realm of "untested but I think it works" for a while, as it's a weird edge case and I don't have the time or inclination to thoroughly vet my statement right now.
As long as it has 100% test coverage I'm fine with it. Who cares if it actually works, right?
7
16:58
@rdlowrey
in PHP, 1 min ago, by Levi Morrison
0
A: How is SplSubject/SplObserver useful?

Levi MorrisonIt's quite simple: it's not useful for an event system. The observer pattern doesn't lend itself to saying, "This thing was updated by X". Instead it simply says that it was updated. I have actually created a flexible mediator class that could be leveraged for this purpose. Depending on your n...

Ardent advertising alert! (AAA)
user895378
lol
user895378
AAA ... I like it :)
I haven't gotten as many upvotes as I'd like to on each answer, but today as a whole has been a productive rep-whoring session.
Especially if I get the +100 bonus.
user895378
17:20
Just officially moved Artax from PHP-Datastructures to Ardent, committed and pushed.
user895378
(that doesn't mean I integrated the streams into Artax yet)
How much did I break stuff? :)
Also, how went backporting changes to streams?
user895378
17:32
@LeviMorrison There were a couple of issues, but in the end I just opted to lose the streams history because there was nothing I needed to keep.
user895378
So it was pretty easy at that point :)
user895378
the updating header on this guy's blog is cool
22:46
I'm at one of those points where you aren't sure what to do with a repository.
It's tested . . . it's been reviewed several times . . . it's been trimmed down . . . what next?

« first day (155 days earlier)      last day (478 days later) »