« first day (432 days earlier)      last day (4502 days later) » 

8:01 PM
@ircmaxell Honestly, I bet the PHP team likes it when things like this are submitted. Anything to help clean up the code is welcome.
 
eih, this seems too small to me... But whatever
eih, this means I'm going to need to recompile
Then again, this is called enough times to possibly make a difference (although the difference in execution is neglagable, since the Z_TYPE_P really is just a macro for offset.type
 
Dan
is it different accessing a 2d array in php, when i go to call it it displays Array[0]? but I even put in var[0][0] and still getting that?
 
@auroraeosrose @ircmaxell true we could do "scalar" - like I said, non-interchangeable typing is fine.
:2180889 Index: ext/spl/spl_engine.c
===================================================================
--- ext/spl/spl_engine.c	(revision 321340)
+++ ext/spl/spl_engine.c	(working copy)
@@ -50,14 +50,11 @@
 		ZEND_HANDLE_NUMERIC(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, idx);
 		break;
 	case IS_DOUBLE:
+		return (long)Z_DVAL_P(offset);
 	case IS_RESOURCE:
 	case IS_BOOL:
 	case IS_LONG:
-		if (Z_TYPE_P(offset) == IS_DOUBLE) {
-			return (long)Z_DVAL_P(offset);
-		} else {
-			return Z_LVAL_P(offset);
 
@ircmaxell I like it :)
 
I would have re-jiggered the white-space, but I decided that's enough for the first part
 
8:10 PM
hi
 
@NikiC Welcome, back, mateo!
Want to talk Exceptions ?
 
no, but I want to note that those fucking assholes fucked up the nice return type hint proposal .. argh
 
@NikiC Well, before you go committing documentation patches for OutOfRangeException and OutOfBoundsException, I'd like to talk to you about the exact phrasing.
 
@LeviMorrison What helly says is the official opinion, what may there be to discuss?
 
8:17 PM
@NikiC How you actually write what helly gave as interpretation.
 
@ircmaxell nice
 
:-D, I'm going to post on internals about it now
 
@ircmaxell why not just ask on pecl?
 
Cause that means I would need to get on irc :-D
what's the server again? efnet?
 
If you post this on internals I might play devils advocate and ask for it not to be commited
efnet, yes
 
8:19 PM
I would ask that too. Give me karma to commit it myself :-P
 
Not for that reason
This is a non-critical fix and thus does not belong into an RC
 
@NikiC Oh?
@NikiC I patched against trunk
 
@ircmaxell In that case everything good :)
 
:-D
#pecl?
or #.pecl?
 
#php.pecl
Hum, bad mood somehow
@ircmaxell thx for github.com/morrisonlevi/PHP-Datastructures/pull/2. That improved my mood quite a bit. Now the repo is in a state that may be looked at.
 
8:30 PM
So... this is interesting..
 
@NikiC lol You really hate require don't you?
 
@LeviMorrison And ?> and many more of the things you did ;)
 
If I have a string such as <p> &nbsp; <p>, load it with domdocument, select that element, and attempt to run this: trim($domElement->textContent), I get back binary data of C2A0.
 
@NikiC :-D
 
@NikiC I am uncomfortable when I don't close my <?php tag. I understand that it can hurt you because of the trailing whitespace problems.
@ircmaxell I'm testing your patch, btw.
 
8:34 PM
:-D
@LeviMorrison when you're done, post a comment to the bug report
 
I forgot to specify -j4 to thread it though :/ It will take a while
 
@ircmaxell sorry about that ; the Android rooms are all empty
 
@user705339 we won't kick you out for it. Don't worry :-P
 
Hm, I didn't notice that Stack is only an interface
 
@NikiC yeah, which is why I put them in the separate namespace (for now)
we can talk about later if they really belong seprate or not, but for now it makes things easier to visualize
 
8:36 PM
@ircmaxell Do we really want to define an interface for every structure?
yeah
@LeviMorrison Okay, now I am in the mood to discuss the exceptions thing :)
 
@NikiC Yay!
 
@LeviMorrison :D
 
@NikiC Yes and no. What I've been basing it on personally is this: Does it appear as a Primitive, Composite or Abstract Data Type here. If yes, then it belongs in an interface. If not, then no it doe snot
So by that thought, LinkedList is not an interface, but Deque is...
 
@ircmaxell Interesting approach ^^
 
Well, linkedList is technically an implementation of a Graph data type...
or a special case thereof
or possibly a one-sided tree...
 
8:40 PM
I would define an interface for APIs that are shared accross several classes that we define ;)
 
actually, not sure. That may not be the best to base it off of...
@NikiC True, but then again, you can implement a stack or a queue using a SLL. So should SLL then become an interface, since both use it?
 
@ircmaxell I'm not sure if your code made a whole bunch of things fail. I reverted before I tested yoru code, but I didnt' save the test output. Have to run again, doh.
 
@ircmaxell No, as we don't e**** the SLL methods
(What's the word I'm looking for?)
 
@LeviMorrison I ran the unit tests first, and it passed
@NikiC expose
 
ah, thanks
 
8:42 PM
Fair enough...
I'm on the fence. Should we implement a Tuple type? It could be useful (it's a fixed array with fixed values)... But then again, it's not hard to implement, and without language sugar, I'm not sure it's really that nice.
Python's are reallly powerful, but then again, they are first class...
 
do we already have a map?
 
@NikiC Not yet.
 
@NikiC ArrayObject would likely fit as one
 
@Tuple What you mean by fixed values?
@ircmaxell arbitrary key ;)
 
@NikiC So I declare $foo = new Tuple(1, 2, 3);, then I can't change the order nor the value of any of those elements
 
8:44 PM
as discussed in irc so that SplObjectStorage is separated into a Map and a Set and both accept arbitrary data
 
@NikiC even objects? Interesting...
 
@ircmaxell that's the main point :)
 
@NikiC A generic map... That's interesting. I'm game for doing it, although implementing it in PHP is going to be... interesting...
 
@LeviMorrison So, do you want to discuss the exception thing or later?
 
8:46 PM
@ircmaxell The work is mainly done already in SplObjectStorage. The problem is that it is a mix between Map and Set.
 
var_dump($map[array(1)]);
 
@NikiC Now is fine.
 
@LeviMorrison I meant implementing in PHP, not in C...
 
@ircmaxell By the way I would opt for the PHP implementations being independent from the C ones. At least the current ArrayList implementation is really ugly because it implements it as if it were done in C. Which doesn't make sense to me :)
 
@ircmaxell You mean a working mock in PHP?
 
8:47 PM
@NikiC Agree
 
@LeviMorrison So, what was the issue?
 
@LeviMorrison yes
 
btw, will the classes be in SPL or in SPL\Datastructures ?
 
@NikiC Not so much of an issue is that I want to make sure we get this right :) How should the exact text for OutOfBoundsException and OutOfRangeException read?
@NikiC I vote Spl\
Also, I vote for that case, Spl
 
@NikiC Well, another reason to implement many interfaces is to type hint the concept in addition to the implementation. So that way you can say I want a map even though Map and Vector really share identical APIs, the behavior is very different...
 
8:48 PM
@LeviMorrison Oh, I didn't even think about that yet ^^
 
@NikiC I'll work on it and report!
 
@NikiC hrm, that needs some thought...
 
@LeviMorrison but currently I'm intending to just write what Tyrael wrote (only corrected) and provide several examples
 
@NikiC I don't like that wording. I'll try to make sure I get the same meaning though.
 
I don't know because of last night I feel more like an OutOfBoundsException or I'm more in the OutOfRangeException mood today.
There was just too much red wine.
 
8:53 PM
@hakre blasphemy...
 
@NikiC From helly's remarks, it seems that more things can throw this than array-like structures. I'm struggling to make it be more generic and still include array in it.
 
@LeviMorrison Huh? I mean the thing about context, not arrays in particular
 
@LeviMorrison which? OOR or OOB?
 
@LeviMorrison I.e. OutOfBounds is context dependent and OutOfRange is always wrong
 
@ircmaxell OOR
 
8:55 PM
oor oob?
 
@NikiC Right, but slapping it up like that isn't good documentation language.
 
@LeviMorrison Absolutely more can. Imagine you were making a chr() function. You can't have a byte with value 260, so it would throw OutOfRange...
 
@ircmaxell yes
@LeviMorrison I think it's good if you provide some examples ;)
 
@ircmaxell I only made the comment because the current documentation implies index only.
 
@LeviMorrison fair enough
 
8:57 PM
We should get this documentation done today, though, so it goes into the updates tomorrow.
 
k, I'll do it now then
 
Okay. So the problem with OutOfRangeException is that it is really no different than RangeException php.net/manual/en/class.rangeexception.php
Exceuse me
DomainException.
In array indices, -1 is not part of the data domain.
Well
Maybe nto
I retract that
But 'asdf' is never part of the domain.
And StdClass()is never part of it either.
OutOfRangeException is DomainException in different, more confusing clothing.
 
@LeviMorrison it is. Because Data Domains are different in principle then ranges
 
@ircmaxell Something in a domain maps to something in the range. In the array example, the index is the domain, and the value is the range. StdClass() is not in the domain of integers. It is a DomainException.
 
@LeviMorrison Well, I see Domain to be a fixed vocabulary (such as an ENUM), whereas range is a (likely numeric) range of acceptable values (for one reason or another)
You wouldn't extend a domain at runtime (normally), but you could possibly extend range...
 
9:05 PM
@ircmaxell How many errors does the current php-trunk have for you? I'm not sure what it would be.
 
Tek
I have a 22MB xml that I need to output values from using DOM. It stops outputting around 229 lines. I raised set_time_limit, is there anything else I need to take into account?
 
@LeviMorrison I haven't built it in a while, so not sure, checking
 
@ircmaxell Exactly. StdClass is NEVER a valid index value for an array. Ever. StdClass is not in the domain. Ever. Now, -1 never will be part of the range, but theoretically it could be. It's just out of bounds. Range and bounds SHOULD have been the same thing.
@ircmaxell In any case, I get dismal results.
 
@LeviMorrison You're confusing things. That StdClass would be out of bounds if I understand it correctly
 
@ircmaxell Not a chance. Not even close. StdClass is DEFINITELY not part of the domain of valid index keys.
 
9:08 PM
@LeviMorrison But you're using Domain wrong there I think
 
@LeviMorrison why are you testing it?
 
@NikiC To make sure @ircmaxell's patch didn't break anything for me.
 
To me, a domain is an enumerated set of valid values. Whereas a numeric range (such as array indexes) is a non-enumerated set of valid values
 
But, the numbers seem wrong.
@ircmaxell I like that definition. The domain for array indices is integers. StdClass is NOT in that domain. It's not a range issue. -1, now that's a range issue.
 
Okay, I see that we should postpone the docs change until those questions are answered
 
9:11 PM
@LeviMorrison Well, array indices does not have a domain in that definition
 
@ircmaxell You aren't familiar with math definitions, are you?
 
@LeviMorrison To your information, @ircmaxell studied math ...
 
@LeviMorrison I am...
@LeviMorrison In Math, domain has many meanings based on what branch you're in
 
@ircmaxell In mathematics, a function takes a value in the defined data domain, and maps it to a value in the range. Correct?
 
hey @Charles
 
9:14 PM
@NikiC Hello
 
@LeviMorrison yes
 
Array indexing is a function, through and through. It take one value (domain) and maps it to one value in the range.
 
but you are altering the wording
 
See my point?
 
it's not defined data domain, it's value in the domain and maps to value in range
data is never mentioned there
 
9:15 PM
@ircmaxell Forgive me for adding it. It doesn't change how it applies to array indexing.
 
Then again:
 
f(x)->y Function f takes a value in the domain x and maps it to a value in the range y. That is exactly what array indexing is.
 
In data management and database analysis, a data domain refers to all the unique values which a data element may contain. The rule for determining the domain boundary may be as simple as a data type with an enumerated list of values. For example, a database table that has information about people, with one record per person, might have a "gender" column. This gender column might be declared as a string data type, and allowed to have one of two known code values: "M" for male, "F" for female—and NULL for records where gender is unknown or not applicable (or arguably "U" for unknown as a s...
 
@ircmaxell I'd say that the data domain for array indices is integers. Classes, resources, and strings are not in that domain.
 
@LeviMorrison eih, I don't care for it in the concept of exception names, but whatever
> I think THIS is the ideal example on why we do not want to 'fix problems' in PHP just because something else does not work properly. If I pass a numeric value to a parameter in my database interface I do not worry about how that parameter was provided. I would treat the above example as a simply bug in MongoDB and is actually one of the reasons I have not bothered even looking at it as an alternative.
I really want to reply as that's one of the most moronic things that I've read yet...
 
9:22 PM
@ircmaxell It's not that I do, either. The fact is, the names OutOfBoundsException and OutOfRangeException should have meant the same thing. They don't at the moment. We also have DomainException and RangeException. In my opinion, OutOfRangeException and RangeException, by name, are superfluous though possibly not. And what does that make OutOfBounds? It was all very poorly thought out.
 
very
 
All that meta-name-calling is getting a little on my nervs
 
@ircmaxell I did mentioned that they fucked up the return typehinting proposal, didn't I?
 
I'd say let's just define new exceptions in our library that all make sense. But that fact alone would make it less likely to be integrated, as it would deviate quite a bit from what is currently there.
 
awstats vs google analytics.. which one is faster and reliable?
 
9:24 PM
Every single heated dicussion on internals results in various places calling other people morons or worse
@user994144 Completely different approaches and not comparable at all
 
@edorian I didn't call him a moron. I said what he wrote was moronic :-D. There's a difference
@LeviMorrison I think the exceptions are too prevalent to redefine. Honestly...
 
wasn't talking about you specifallc
 
yeah, I know
 
(english)that sentence
3
 
or at least I assumed
 
9:26 PM
@edorian which one is preferred to help optimize site performance
 
@edorian Well, sorry, but I just can't help it. I really hate how they handled that return type hint proposal by hijacking it into a general type hinting discussion.
 
@ircmaxell I agree. Sigh. I really wish I had been born ten years earlier as far as this stuff was concerned. Then I could have defined it all correctly :) Oh well.
 
:-P
 
I mean. . . can we just deprecate OutOfRangeException quietly? Just add a little note on the documentation? Not tell anyone?
btw, @ircmaxell I'm retesting your patch on a clean install right now.
 
9:30 PM
Ok, I'm out. Probrably will be back before long
 
@LeviMorrison throw Exception to the rescue :)
 
Hey, there is some good news, though.
@ircmaxell's patch is clean on my system too :)
 
Well, how could it be different ^^
 
Dbz
@LeviMorrison, Hey man! I'm back. I'm trying to take apart that clever little explode algorithm you threw me, and I think I found a bug or two and am hoping you can help me debug it possibly? If you're too busy, I'm sure I can handle it on my own.
 
@Dbz I'm available, sort of. Let me know if I can help.
@NikiC I dunno, but that's what lots of people have said about things :)
 
Dbz
9:38 PM
@LeviMorrison, can I start a new room with you in it?
Or is that not an acceptable thing to do
 
@Dbz Just keep it here. It's easier for me to follow.
 
Dbz
Alright
I'm making a viper-7
 
Tek
So I have a DOMDocument loop that reads off a large XML file... It's stopping at around 229 results even though $domnode->length reports 4251 results. set_time_limit is set to 0 just in case. Anything else I need to take into account?
 
@NikiC So, my RFC on the issue remains accurate according to the conversation with helly. That's good news, too. Think I should make a summary of this conversation in the section on exceptions, though?
Also, @ircmaxell did you try committing your patch? Are you sure you don't have commit karma? I know you have a php.net account.
 
@LeviMorrison He doesn't.
 
9:45 PM
@Dbz , FYI , that seemed kinda like too much information
 
Dbz
@LeviMorrison viper-7.com/9tiuil
 
because viper-7 is a nickname for a guy in freenode's ##php channel
 
Dbz
@tereško, what did you mean?
 
@LeviMorrison If you want to, you can ask Tyrael to commit it (through PN). He is the nicest guy from src (just like philip from doc)
 
6 mins ago, by Dbz
I'm making a viper-7
@Dbz , im talking about this line
 
Dbz
9:46 PM
@tereško, I meant the link I just pasted
Or were you making a joke?
Today is only my second day of php coding
 
@Dbz I think @tereško thought that you were building a codepad like viper-7 ;)
 
Dbz
Nope, not that good
haha
 
no , i was thinking more along the lines of a voodoo or blow-up doll
 
@tereško ^^
 
@NikiC Honestly, I think I can commit it. Unless the person who approved my account as a documentation one. I asked for PHP access, though.
 
9:49 PM
@NikiC , my mind is much more rotten then you might suspect
 
@LeviMorrison No, you definitely can't
@tereško Well ...
 
Dbz
@LeviMorrison, I don't think you can use explode
 
@NikiC Yeah but I sometimes wish that all would be said in the place where it belongs and not dragged though all somewhat related places first. But I guess it's part of the process of figuring out what to say ;)
 
what is exactly the problem you have been trying to solve , @Dbz ?
 
Dbz
@tereško, I have a string, and a letter. I want to find the fastest way to find that the indicies for that letter in the string
 
9:52 PM
@LeviMorrison Philip approved your account and he obviously knew what you asked for ;) Also, you can see who has which rights in global_avail. And it says that Gordon, ircmaxell, you and me all only have doc access ;)
 
strpos() function is the fastest way
 
strpos
Ah. To late, nvm
 
php.net/manual/en/function.strpos.php , look at the link , @Dbz
 
Dbz
So, if I have a string "qrqrwqxwqrq", and I'm looking for q, I should have 5 indicies at 0,2,5,8,10
 
@tereško See, you often say bad things in here, so I assume that it is somewhat rotten ;)
 
9:53 PM
@NikiC Where is that document?
 
Dbz
strpos only finds the first instance though
It doesn't return all of the indicies
Which is what I'm trying to do
 
@LeviMorrison in SVNROOT
 
Dbz
Offset
Thanks for the help! I'll try making the function
 
@Dbz , do you need just the position of the letters , or are you going to do something with them afterwards ?
 
Dbz
@tereško I just need the positions, I'm doing something with the positions, but I'd rather try to write my own function and then ask for optimizations. I don't want other people to write code for me when I can do it on my own.
 
9:57 PM
in that case i would just make a loop through the string , and add each new position to an array
 
@Dbz For a change someone who doesn't want us go givehimtehcodez, nice
 
when loop is done you would have an array with all the indexes where letter was found
 
Dbz
@tereško that's what I was thinking of doing, and @NikiC, thanks haha =]
 
Tek
Found out why it was stopping. Using DomDocument's getElementByName() when nodeValue retrieves the data it stops the script at the following character: "&lt;"

Anybody know why?
 
@Dbz just loop, don't explode:
function findSearchPos($string, $letter)
{
	$indices = array();
	$offset = 0;
	$len = strlen($letter);
	while (FALSE !== $pos = strpos($string, $letter, $offset))
	{
		$indices[] = $pos;
		$offset = $pos + $len;
	}
	return $indices;
}
 
Tek
10:02 PM
Nevermind, got it. Using htmlspecialchars() lets me continue running the script
 
&lt; is a new node, an Entity node.
 
@hakre , i would definitely not do it this way , but idea stays the same
 
@hakre That isn't quite right, but that's the idea.
@hakre @tereško @Dbz How about: viper-7.com/xiCXZu
 
whats with you all an the magical while loops
the guy is just now learning
 
@tereško I know, I 'helped' him with the explode version based on someone else's comment.
 
10:07 PM
hell .. it's confusing even for people who know php quite well
 
@tereško What's so confusing? I at least used () to show operation precedence.
@tereško would you prefer this nasty forloop? viper-7.com/p4CMZA ; It's the equivalent loop for the while if you don't want to assign and check in the same instruction.
 
i dont get why you all want to use strpos()
 
Dbz
I'm trying to write my own version as well, but I'm having some difficulty for some reason =/
@LeviMorrison, do you see a reason why this function I just made isn't working? viper-7.com/eRCkFU
 
10:23 PM
@Dbz , because in the loop you are overwriting the $indicies variable
 
@tereško Exactly.
 
Dbz
Yeah
I just saw that
viper-7.com/Yrp2n8 still doens't work though
 
$indicies = array();
$indicies = strpos($string, $letter);
You are still overwriting it.
 
Dbz
Oops
 
@Dbz You don't want to store it in the array until you have verified it isn't false.
 
Dbz
10:28 PM
Is there a difference between false and 0?
 
@Dbz yes
 
Dbz
Okay
 
@Dbz When you use !== there is.
 
Dbz
That changes things then
 
@Dbz false will be returned if there are no more matches, 0 means there is a match at the first character
That's why you should use type strict comparison (=== or !==)
 
Dbz
10:29 PM
Okay
 
@LeviMorrison what's the problem with the code I posted? Missing boundary check?
 
Uh, SOPA seems like really big GoDaddy marketing fail :)
 
Dbz
Hmm, @LeviMorrison and @tereško, I made a new version: viper-7.com/vlNH0e but it isn't working because I have a logic error. Does anyone see it?
Nevermind, it's working perfectly, I typed the string in incorrectly.
I apologize if @LeviMorrison or @tereško looked at that last link looking for an error!
 
sorry .. im taking a nap
 
I somehow feel that 90% of tech news currently is about SOPA ^^
 
10:46 PM
Oh google.
 
@stevether nice
 
@NikiC For me every commercial is a goDaddy marketing fail
And people that give a duck about sopa are not their target demographic anyways I'd say.
 
@Dbz Do you understand this: viper-7.com/enD3xW ?
 
Dbz
No
I don't
You're using syntax I haven't tried yet
 
What don't you understand?
 
Dbz
10:54 PM
array(0,2,5,8,10); for starters
I don't know what that does
 
@edorian do not understand?
 
Dbz
I assume it makes an array with those values ?
 
@Dbz It creates an array with those initial values.
 
Dbz
array[4] = 10 in that line?
k
 
@NikiC All i every seen from GoDaddy was "Booobies!" and thats not really what I'm looking for in Webhosting
 
10:55 PM
Anything else?
 
Dbz
Yeah, I've never used a foreach loop
 
Okay.
foreach ({whatever it is you are looping on} as {this is the index} => {this is the value at that index})
 
@edorian ^^ I've just seen some posts around reddit and hn about people moving their hundreds and thousands of corporate domains from godaddy because of that sopa thing ;)
 
And the index and value change to the next one every time it loops.
 
Dbz
hmm
 
10:57 PM
@LeviMorrison By the way, foreach is something that PHP really got right I think. Did they steal it from somewhere?
6
 
@NikiC Hmm. . . let me think about that.
 
Dbz
So basically
 
@NikiC I always thought godaddys main clients would be people that have basically no clue what so ever . Well if that helped then all well i guess
 
@NikiC Not that I know of, now that I think of it.
 
@NikiC <3
 
Dbz
10:58 PM
IF I have foreach($question as $index => $answer), then $question[$i] = $answer; ?
 
@Dbz Correct.
 
Dbz
That's simple. I can handle that =]. How about the functions array_diff() and empty()?
 

« first day (432 days earlier)      last day (4502 days later) »