« first day (790 days earlier)      last day (4174 days later) » 

8:00 PM
Well, but things get tricky there
because is it sorted or not
Well, actually, we can ignore that part
 
I don't see how that's relevant. Glad we see the same on that portion.
 
I was thinking SortedSet vs Set
Specifically triggered by order of iteration, but that doesn't matter
So Collection becomes Countable, IteratorAggregate + one helper function isEmpty()
 
Basically.
 
which you could argue if is necessary or not, but I'd say leave it (as it compliments Countable nicely)
 
8:02 PM
but contains... that's a tough one
then again
is a Queue really a collection...
For example: does it make sense to count a queue? Or just see if it's empty?
 
I think count could be viable.
Think of some kind of priority queue that only keeps the top 100 items or something
But that's not necessarily Ardent\Queue. I was just thinking queue in general.
 
Well, a priority queue is not a queue. It's a heap...
well... not really
but implementation wise
The way I look at it is this: If I wanted to make a stack using the most efficient data structure possible, what would that be?. And my answer is basically to use a Single Linked List, as push, pop and peak are all O(1) operations, and memory is O(n)...
And if you use that data structure, what API would make sense
and really, the only ones that do are push, pop, peek and isEmpty... Everything else requires significant logic to get around...
 
Well, count doesn't affect that at all. You add a small constant time to keep track of add/remove.
 
right, but that's more logic. Which doesn't mean that it shouldn't be done. Just that it takes slightly more thought
 
I mean, not everything in the repository has to be a Collection.
 
8:10 PM
@ircmaxell ... dose PHP have inbuilt Single Linked List ?
 
@Baba No.
 
no (not yet at least)
 
Oh ok .. guess as much
 
They have SplDoublyLinkedList.
And I hate what they did with it.
 
SLL isn't really an overall useful structure, except for very narrow use-cases (such as the underlying structure of a Stack or Queue)...
 
8:12 PM
And say what you will about the current Stack and Queue in my repo, but I still think they're drastic improvements to Spl\Stack and Queue.
 
@LeviMorrison Oh, they definitely are
 
@LeviMorrison sometimes PHP spl Database can really be confusing
 
@Baba sometimes always.
 
don't get me wrong, I'm loving what you're doing. It's huge improvements over what we have already...
 
@LeviMorrison and incomplete
 
8:13 PM
I'm just nitpicking a few parts in there to possibly make it better
 
Which is exactly what I asked for.
I don't know why, exactly, but not having the size of my stack or queue known is unnerving.
I can't really place why.
I think I'll keep Countable on them.
And I'll remove contains from them.
I can always add them back in, but removing them later? Not a chance . . .
Not after 1.0.0.
 
@LeviMorrison See to me, the usecase of a stack or queue is that it represents a ball feeder. You want to know if there's a next ball, but more often than not you don't care about how many balls are in there
actually, now that I said that, I thought of a use-case for count. Ok, I'm on board on that one
basically, if you're queuing TCP connections (in a node.js style server), you want an upper limit on pending requests, otherwise you'd wind up blowing memory instead of rejecting those connections gracefully...
 
@ircmaxell Also, could you check my set algorithms for correctness?
 
I can try
 
I feel like I missed something critical.
 
8:16 PM
any particiular class you're worried aobut?
 
The stuff in AbstractSet.
 
Which is probably a horrible abuse of inheritance.
That or brilliant.
Sometimes the line is so thin . . .
 
Anyone up for a bit of CSS problem?
 
What the avatar change?
Is that a black man on a unicorn?
 
8:18 PM
@LeviMorrison It's Madara on a unicorn :D
I want my footer to be 100% of the page's width, instead, it's set to 100% of the window width (meaning if I scroll sideways on smaller screens, it cuts there)
Like so ^
 
@LeviMorrison: looks good to me
 
@ircmaxell @rdlowrey I think I'll nuke ArrayQueue. Any objections?
 
none from me
 
user895378
@LeviMorrison Not from me.
 
Feels good to delete some things.
If I'm always code but never deleting things I get nervous.
 
user895378
8:23 PM
Is there a good reason to allow people to switch in and out of encrypted mode willy-nilly on a socket stream? Or should I keep Socket and SslSocket as separate classes which either provide encryption for the entire communication or don't?
 
the one that you're missing is symmetricDifference: A ⊖ B = {x : x ∈ (A \ B) ∨ (B \ A)}
 
user1125394
@rdlowrey I didn't read the ssl rfc's
 
@rdlowrey Depends, Where's the SSL implementation? Above or below the socket layer (because it's not at it)
 
@ircmaxell It exists in one of them but not the other, irrespective of which side of the operator it is on?
 
@LeviMorrison correct. Basically XOR
 
8:27 PM
Also, would you advise renaming relativeComplement -> complement or keep the verbosity?
 
user1125394
exclusive OR* (deleted it by mistake)
 
@LeviMorrison Well, I'm torn on that. On one hand Relative implies that call order matters. But on the other hand, complement implies that as well.
actually, no
relative should stay
 
user895378
@ircmaxell I'm establishing the tcp connection asynchronously, then once the connection is made using stream_socket_enable_crypto to negotiate the SSL stuff. The second argument to stream_socket_enable_crypto is a boolean flag which allows you to "Enable/disable cryptography on the stream." ... so I was wondering if I should expose that capability in the overlying object interface.
 
otherwise you have a super-set issue that you don't know where it would be...
@rdlowrey Sounds like a bridge design to me. Have a "connection handler" which gets dispatched on connect...
that way you could load the "raw" handler, which does nothing, or the "crypto" handler
 
CAM
@ircmaxell Just watch your videos on programming w/ PHP Pretty Dope!!!
 
user895378
8:31 PM
Sold.
 
@CAM thanks!
 
CAM
now that i have you hooked.. Im dealing with an issue w/ OSX install of Mcrypt
i used brew to install mcrypt
 
user895378
IMPORTANT: Going to see matinee showing of The Hobbit in a few minutes. Need input: 3D or Regular?
 
why brew? Why not pecl?
 
8:33 PM
@ircmaxell how is your book with @NickC progressing ?
 
@rdlowrey I'm a fan of the newer 3D stuff.
When it came out I was like, meh.
 
CAM
whats the pecl packeage name ?
 
I wish we didn't mention that publically
 
CAM
Doh
why not?
 
Oh, that's right, it's in core, nevermind
 
8:34 PM
But now landscapes are in lovely 3D, which is nice.
 
@CAM what video is that
 
user895378
@LeviMorrison Same ... though I haven't seen a 3D movie in a while to have my opinion changed.
 
lol
 
CAM
Doh
one sec
 
@rdlowrey If the landscape of NZ is in 3D then it could be amazing.
 
user895378
8:35 PM
Very well ... 3D it shall be. Will report my findings upon completion.
 
CAM
 
cool
 
CAM
np
 
i could subscribe , but i feel it would be counter productive
 
@Baba And there are more: youtube.com/…
@tereško why?
 
CAM
8:37 PM
i think he's being a DB
 
watching it now ....
 
CAM
@tereško where is programming w/ @tereško
 
1) any new video would be burried in the stream
2) if i start adding more subscribed channels, they will get lost in the new interface sidebar
3) those videos end up in the "stared list" anyway
^ @ircmaxell
 
Ahh...
I only subscribe to a few channels. And YouTube screwed the pooch on the new sidebar. I like the rest of the interface, but eih
 
CAM
8:39 PM
@ircmaxell any ideas on my dilema?
 
locate mcrypt.so
 
i actually have already something like 20 subscriptions: ~5 gaming related , ~3 news , ~5 atheist/science , 4 dev/hack channels and ~10 "dead channel bookmarks"
 
ah ok
 
CAM
8:42 PM
yea tried to locte it but it only found the one on my MAMP setup
 
@ircmaxell ... nice video
 
CAM
tried copying that and the sigs did not match
 
@CAM i have actually been dumping all the free time in finally making that "framework idea" into are real thing .. unfortunately , Jim Butcher's new book was released this week ... thus , no changes on that front
 
8:43 PM
btw. @ircmaxell , have you been reading Dresden Files books ?
 
not yet, on my list
 
my honest recommendation
 
but be warned that first two are little "slow"
 
CAM
Ahh...@tereško, have you played w/ Laravel yet ? pretty sweet
 
8:45 PM
@CAM i tend to avoid "all static" frameworks
 
speaking of those videos, I need to write the script for the next one... Logic...
including some tricks that many people don't know (even if they think they know boolean logic well)
 
@ircmaxell , you could make one about JS .. particularly the closures and different usecases where they can be user .. i could feed it to my new co-workers
 
Can anyone help me with a CSS bug? I have two float left's for the big images and transition/rotator and on firefox and IE a padding appears at the top, while chrome looks fine.
http://medianajafidds.com/Kashani/
 
8:49 PM
@ircmaxell Okay, so I want a Queue implementation, a Priority Queue, and a shared interface between the two. What to name the queue interface and queue implementation?
 
what are the methods which that interface would contract for ?
(i think this did not come out in english)
btw , i started to push for unit test in my new workplace
.. i think i actually convinced that they should start adding them bit by bit for each new bug
 
hey guys, I need a little help.  I'm using gSkinner's regexr webapp to validate some regex I'm working on and everything looks good: regexr.com?3350g

but when I use the expression on my server it continues to fail and not find any results (I'm not getting an on-screen error).

my usage looks like this:
if(preg_match("/(\d:\w+)|([\s|\(](?!-)(?!.*-)[A-Za-z]+(?<!-)(?!\d).*)/g", $sLine, $matches)){ ... blah blah blah
 
what is this thing doing ?
 
@tereško Yeah, closures would be a very good one
 
8:57 PM
I've verified that $sLine does infact have what I expect it to have by echoing $sLine. $sLine is equivalent to one of the string lines that you see in the gskinner excerpt
 
@LeviMorrison hrm... that's an interesting one...
because IMHO queue and stack should have the same interface as well. But priorityqueue needs information that makes no sense in queue and stack (namely priority)
 
not really
 
@tereško it isn't entering into my if statement, if I echo the preg_match statement I get nothing
 
(and yes, I accept pull requests ;-)
 
the difference would be only in HOW you put the data in the "structure". PriorityQueue would store it in a bit different form. When you get the data out, the methods would be the same
 
8:59 PM
@tereško right. So unless you only make an interface for the "out" part...
 
you just initialize the PriorityQueue with the spefific conditions
the putting in methods are actually the same
 
Well, the push() needs to have a second argument (priority)
 
hmm
i assumed that PriorityQueue was an queue that is ordered based on some condition
fact taht you push() a tuple instead of simple variable would not really change the API
 
@tereško Well, considering that PHP has no concept of a tuple...
 
$tuple_ish = [1,2];
 
9:02 PM
that's dirty
 
kinda
i have been using too much JS lately
 
yeah...
 
@sadmicrowave is the $match completely empty ?
 
@tereško $match is NULL for each $sLine that the preg_match bounces against
 
@ircmaxell Constructor solves that particular problem.
Not push.
Well
In a traditional object-oriented world, anyway.
 
9:08 PM
@sadmicrowave currently all i can suggest is for you to disassemble that regexp and start adding conditions one by one .. see what matches you get in each step
 
51
Q: Uncatchable ChuckNorrisException

Max CharasIs it possible to construct a snippet of code in java that would make a hypothetical java.lang.ChuckNorrisException uncatchable? Thoughts that came to mind are utilizing for example interceptors or aspect oriented programming.

 
@LeviMorrison how?
 
@ircmaxell You take a function that determines priority for the pushed item.
As I noted, that's only really a solution for something object-oriented.
 
Well, that's possible for priority that can be determined algorithmically from the input. But not all priority can
 
A queue of sockets would fail, for instance.
 
9:10 PM
@tereško alright I'll start there. Here is the question I've posted related to this incase you think of more: stackoverflow.com/questions/13886285/php-preg-match-not-working
 
posted on December 14, 2012 by Anna Filina

My experience taught me to be verbose and meaningful. I will not talk about code cosmetics. Here are three simple questions. How many times will you write this line of code? How many times will you read that line? How many other people will read it? The answer to the first question is usually “one” and the answer to others is “more than one”. Simple logic tells us that code must be optimized

 
no /g
what you want is preg_match_all()
 
@tereško excellent! - thanks dude
 
FYI:
0
Q: How to deal with highly voted answers with security vulnerabilities

ircmaxellThere's already a question on how to deal with questions/answers with a security vulnerability. But that's not really what I'm asking. Here's the problem. There's a post in PHP that is highly upvoted with lots of references: Best way to use PHP to encrypt and decrypt passwords? Now, the top an...

 
9:15 PM
@sadmicrowave , you should be developing with error_reporting = E_ALL
 
@tereško with PHP 5.3+; otherwise maybe with error_reporting = -1
 
well ... he currently has error_reporting = E_ALL ^ E_WARNING .. or something along the lines
and i am assuming that most of people currently are using php5.4 in the development environment
 
I don't know about that. Not that the place where I work is particularly keen on keeping up with the times but we only got 5.3 a month or so ago
actually because we are on Debian Squeez
 
@ExplosionPills We follow the Debian releases as well.
However, we do make efforts to make it future compatible before we upgrade.
 
My stance: if you're using a package installed version of php (debian, ubuntu, centos, redhat, whatever) to do dev with, you're doing it wrong...
 
9:28 PM
meh
use freebsd
the ports-system lags behind latest released for a 1 month-max (and that's only for the major releases, not the minors/patches)
 
It's not up to me; it's up to our NOC people
 
@ircmaxell that particular question is gone now.
 
I'd love to use 5.4; and 5.5 looks exciting
 
Anonymous
Does anyone know why it is important to sanitize $_SERVER['SERVER_SELF'] with htmlspecialchars() ?
 
what is SERVER_SELF?
 
Anonymous
9:31 PM
Sorry I meant. $_SERVER["PHP_SELF"]
 
:-D
 
@ircmaxell instead of using a package installed version what should you use?
@Eritrea under what circumstances is PHP_SELF going to be used? You wouldn't always sanitize it that way
 
Well, you can install it from a package, but from one that gets updated more than once every 3 years. Aka: use a good repository (like REMI for CentOS or whatever exists for debian), but don't use the core repo...
 
I think that our NOC people just don't want to do that because it makes it more work to update later on
 
How do you label issues on github?
label stuff as or
 
9:35 PM
@MadaraUchiha I think just put a # in front of it
oh nvm I thought you meant something else
 
@ircmaxell As @ExplosionPills noted, it's not always up to the developer but to a systems administrator or the like.
 
@ExplosionPills Not reference :P
 
Our codebase is PHP 5.3.0 - PHP 5.4.6 compatible, and probably higher but we haven't tested it.
 
@MadaraUchiha yeah I got that; sorry
 
Oh, looks like you need to be a collaborator
 
9:37 PM
@ExplosionPills It makes it less work, because you'll be running supported software instead of weird hybrid
 
Good evening every body
 
@LeviMorrison Pretty sure our code is 5.4 compatible, but we can't use its features ><
 
@ExplosionPills I think the next version our codebase will jump to for a minimum will be 5.5.
 
9:38 PM
@ircmaxell as far as I know 5.3 is still supported -- they released an update for it less than a month ago
 
No, it's not 5.3
it's a weird hybrid of 5.3, because they backport some fixes back
 
so even though it's listed as 5.3.3, it's not. It's not compatible with any released PHP version, because it's their own weird thing
 
it says 5.3.19
 
@Bart Do we care? I hope we care that over one hundred thousand visitors were given dangerous misinformation from massively-upvoted posts. We can do better than that. — Jeremy Banks 2 mins ago
^^ This
 
9:40 PM
just curious, but what is the vulnerability in that answer? md5?
 
read the comment thread
 
Anonymous
@ExplosionPills It will be used for self submittingh
 
Anonymous
*submitting
 
ok .. so .. JS room cleared it ..
anyone here can find something that i should change in jsfiddle.net/teresko/ZG3z9 ?
 
So when the query returns 0 rows, everything stops, I can't even echo anything before the query. I haven't had any luck finding a solution on the boards.

$sql2 = "SELECT clientId, studentEmail, studentPassword, studentFirstName, studentLastName, parentEmail, parentPassword, school
FROM clients
WHERE (studentEmail = '$postEmail') OR (parentEmail = '$postEmail');";

if (!$result2 = $connection->query($sql2)) {
die ('There was an error running the query [' . $connection->error . ']');
}

$rows2 = $result2->num_rows;
 
9:45 PM
Please, don't use mysql_* functions in new code. They are no longer maintained and are officially deprecated. See the red box? Learn about prepared statements instead, and use PDO or MySQLi - this article will help you decide which. If you choose PDO, here is a good tutorial.
 
im not, im using mysqli
 
it doesn't show
since you are not using prepared statements
 
yeah i started with prepared statements and had some problems so I ended up with this...it totally works when $rows2 >0, but just causes everything to go blank when $rows == 0
 
is it possible that the query is failing
 
i mean, i can't echo it because everything appears blank, but its correct and echos correctly when $rows > 1
 
Anonymous
9:48 PM
ALL: What is the purpose of sanitizing $_SERVER['PHP_SELF'] ?
 
I forced an error in the query, and the error message appears correctly
is there a better way to return the face that there were no results?
fact*
 
@tereško why useCapture for blur event?
 
Anonymous
@ExplosionPills I need your advice buddy
 
you need to know why to sanitize it? it depends on how it will be used
 
@radleybobins have you set the MySQLi to throw exceptions ? uk.php.net/manual/en/function.mysqli-report.php
 
9:52 PM
@tereško Dude! That's freaking awesome! never knwe about that
 
Anonymous
It will be used only for submitting. like: <form action=".$_SERVER['PHP_SELF']."
 
Anonymous
@ExplosionPills Check above
 
no, i haven't, I will go work on this now, thanks
 
it needs to be sanitized with htmlspecialchars because it may contain something like quotes or < or >
I don't think it's likely .. but better safe than sorry
 
Anonymous
@ExplosionPills but it does not matter what the a person puts inside the url, because the server can only post into a url it loads. You can not change the url with injection codes and hope when you press submit, it will go through. Right?
 
9:55 PM
correct, but it's possible that the URL will have such characters I think
so you would end up injecting yourself
 
@ircmaxell you linked me to it
<_<
i think it was you
 
Anonymous
@ExplosionPills I think you are right. But, if the server loeaded a url with malicous code in it, I think it would have been injected before the url had a chance. Anyway, I say this code in this good website. phpmaster.com/easter-eggs-what-they-are-and-how-to-create-them/…
 
Anonymous
You can Ctrl+F and search for $_SERVER['PHP_SELF']
 
Essentially you should use htmlspecialchars on any variable output, especially if it comes from the user
specifically with ENT_QUOTES
 
Anonymous
@ExplosionPills Ok. I will cosider that, but why htmlspecialchars over htmlentities ?
 
10:05 PM
htmlentities is fine too, it just encodes all available entities; usually stuff that cannot be used in injection (although I guess you never know)
12
Q: htmlspecialchars vs htmlentities when concerned with XSS

stuckinphpI have seen a lot of conflicting answers about this. Many people love to quote that php functions alone will not protect you from xss. What XSS exactly can make it through htmlspecialchars and what can make it through htmlentities? I understand the difference between the functions but not the d...

 
Anonymous
thanks
 
@tereško I don't think so...
 
in that case , "you're welcome"
 
Windows and UTF-8 in exec don't like each other?
 
but i am completely sure that someone in this chat room linked me to it, because i was using"error management sucks" as one of arguments against mysqli
@webarto yes
 
10:12 PM
@tereško In fact, I've heard that argument plenty of times and whole-heartedly agreed with it.
All along MySQLi could throw exceptions and basically nobody knew about it?
 
@tereško shell_exec('@chcp 65001 > nul && ' . $command); I was hoping this would fix it, but no luck...
 
urlencode it or something
 
@webarto Only one & is needed in Windows, BTW
 
utf8 as shell parameters will fail 9 time out of 10 on windows .. and about 6 out of 10 on nix
they work sometimes , but i would not bas anything critical on it
 
convert ( -background none -fill '#FF0000' -font 'static/fonts/Lobster.ttf' -pointsize 72 label:'¡Viva España!' ) static/cache/0441541224637482c57b03983f931e9ccbea13e5.png

convert -size 501x91 xc:transparent -tile gradient:'#FF0000-#FFCC00' -font 'static/fonts/Lobster.ttf' -pointsize 72 -gravity center -annotate +2+0 '¡Viva España!' static/cache/0441541224637482c57b03983f931e9ccbea13e5.png

convert static/cache/0441541224637482c57b03983f931e9ccbea13e5.png ( -background none -fill black -font 'static/fonts/Lobster.ttf' -pointsize 72 label:'¡Viva España!' -geometry +0+2 ) -compose dstover -c
Works on Unix, perfectly. But on Windows...
Unless I type it in directly in command prompt which is not an option.
Either way, I'm just curious.
 
10:17 PM
what if you make a *.cmd file and then execute it ?
 
@tereško I think that would probably work, or read command from UTF-8 file. I will try.
@tereško @ShaquinTrifonoff thanks
 
@ircmaxell Yes, but this problem applies to anywhere you see a highly upvoted answer that you think is wrong. There is nothing special about security risks. The voting system works in the majority of cases but sometimes fails, you'll just have to live with that. Introducing a parallel voting system is no solution. — Asad 2 mins ago
 
Anonymous
Is there a list of 20 - 50 of the most useful PHP built-in functions, that a newbie like me show learn?
 
10:34 PM
don't learn functions
learn how to find them
 
I would just suggest you browsing the function list on php.net
 
Anonymous
@ualinker thanks, but for a newbie, list of functions in php.net is too many
 
@Eritrea you open google and type in : "find string in string site:php.net"
 
Anonymous
@ircmaxell I don't think I can find which one is more makes like easier
 
10:37 PM
forget that
 
@Eritrea as a newbie , the most important thing to learn is "how to work with php arrays"
 
php.net/text-you-are-looking-for
 
hell .. most of people here who have been using php for 5+ years still use php.net to find out in which order to pass parameters in in_array() or strstr() function
 
seriously
 
Anonymous
@tereško Don't even get me started with arrays. I still can't understand the profound difference between arrays and variables.
$variable = "test";
$array = $array("test");

echo $variable;
echo $array[0];


They take same space to write, same result. As complete begginer? what is the difference????
 
10:41 PM
think of the array as long line of boxes
each box has a name, which is the key : 0, 1, 4, 'foo', 6
variable will usuall contain a value, an array or an object
well .. basically get a book
@Eritrea i recommend this one : Beginning PHP 5.3 .. it's the least outdate in past few years
 
@NikiC and @Gordon and @TimPost : Here's that Meta post: meta.stackoverflow.com/q/158741/147370
I'm out, good night all
 
Anonymous
I can think of array a long line of boxes, which can hold many variables OK!

But, that this as an example, array and variables respectively.


$array = array("one","2","big","red","first",);

$one = "one";
$two = "2";
$big = "big";
$red = "red";
$first = "first";

echo array[2]; // outputs " big "
echo $big; // outputs "big"

Now, tell me, where is the advantage of the array over the variable?
They took the same amount of space to assign data, and the same amount of space to call it.

So, where is the difference in the above example?
 
@Eritrea With an array you can do this:
foreach($array as $value) {
echo $value;
}

Print all values from array.

Whitout an array you must echo each variable.
 
foreach( $array as $key => $value )
{
     var_dump( $key, $value);
}
@Eritrea ^
arrays are used for lists
for example, when you get your blog's articles from the database, you will store them in an array and then loop over them too generate output
 
Anonymous
So, that is it! to make lists of varibales grouped under an array?
Well, I usually use the while($row = mysql_fetch_array($result)){echo ....} way to get output. So, it won't help me getting data from database. Is there any other event in which you need to use that aside from pulling result from DB?
 
Anonymous
10:53 PM
@tereško @byoigres thanks btw, for the examples
 
@Eritrea find all the positions of letter "a" in your previous sentence
how will you store the results ?
and yes, those all are trivial example, because you do not understand the basics
 
Anonymous
I would say str_pos("a", $my_text)
 
Anonymous
I hope that correct? :)
 
no , i asked , "how would you store the results"
 
Anonymous
I store results into database using the INSERT INTO... way
 
Anonymous
10:57 PM
If that is what you mean
 
will you use:
$a1 = strpos( $sentence, 'a');
$a2 = strpos( $sentence, 'a', $a1);
$a3 = strpos( $sentence, 'a', $a2);
$a4 = strpos( $sentence, 'a', $a3);
?
would it really make sense to you ?
 
Anonymous
Come on! Who needs to store only a line of one letters from a whole text into a database? If that is where arrays become useful, then they pretty much useless.
 

« first day (790 days earlier)      last day (4174 days later) »