« first day (1778 days earlier)      last day (3161 days later) » 

12:03 AM
@ScottArciszewski github.com/defuse/php-encryption/issues/88 I only looked for an existing issue after posting it. Question still stands: timeline?
 
12:27 AM
This doesn't look good
> PHP Fatal error: Exception thrown without a stack frame in Unknown on line 0

Fatal error: Exception thrown without a stack frame in Unknown on line 0
PHP you are useless...
 
1:05 AM
I commented. Unfortunately, defuse isn't exactly swimming in free time
I've been bugging him 2-3 times a week about it
right now I'm trying to help document libsodium and help get that to 1.0.0
the PECL extension I mean :P
the actual library is nearing 1.0.4
 
Yeah I don't want to be that bitchy guy and I know that OSS sucks in regards to this :) no worries
 
I'm building something that, upon release, will require PHP 7.0.0 and libsodium > 0.2.1 (whether the next is 0.2.2, 0.3.0, or 1.0.0 remains to be seen)
it's very hard to show patience when the bottleneck isn't something that you can solve
fortunately, the biggest problem that jedisct1 sees in the PHP extension was a lack of documentation
 
Cool
 
but before I opened github.com/jedisct1/libsodium-php/issues/52 I was worried about being that bitchy guy too :P
 
Anonymous
> Could anyone help PLEASE! I stuck on this for almost a day and need it working by tomorrow
 
Anonymous
1:14 AM
0
Q: instant search not working

Junjie ZhangThe code below was for instant search, such as google search. Note that I didn't include the connect to database function here. Coz I think the database username and password setting would be different to yours.So please create your own if you want to test it. The mysql is set with a table is ca...

 
@ScottArciszewski :-)
Also it would be nice if php-enc had proper phpunit tests at some point with uopz, but I will start thinking about that once @JoeWatkins eventually makes it php7 ready and the project has released a stable v2 @ScottArciszewski
 
yeah, I was going to add unit testing to it, but that PR is already pretty monstrous
 
Anyone know an example in php-src where the calling scope is tested against being able to access a private/protected method of a class?
 
Or did you mean the actual source?
 
I meant source....but i think it's maybe all inside zend_is_callable_ex
 
1:29 AM
Well, sorry for being useless :)
 
2:00 AM
is there any specific difference between codeigniter 2 active record and codeigniter 3 query builder class
 
2:17 AM
Programming with shared mutable state: http://t.co/5bndmkC6FU
 
10 open business class seats. #3 on the wait list. Fingers crossed.
 
don't what it is but all the best for that..
 
2:32 AM
Woo hoo! Upgraded
 
 
1 hour later…
3:59 AM
Good morning
 
morning o/
 
Yo
 
@ircmaxell aren't you over the Pacific yet?
 
4:16 AM
No, LAX right now
 
New Zealand next?
 
no, Australia
 
anyone here good with sql?
I'm trying to brainstorm a solid way to correlate data
 
I Might be able to help
 
4:32 AM
@Orangepill awesome. So what I'm doing is creating event tickets. tickets will have A venue, as well as an event field. Additionally they will have a section, row and seat
 
@ircmaxell have a safe flight.
 
thanks
 
now the tricky part is, tickets will have multiple dates they are for. Basically each date will be for a "new" ticket. As well, they will have price points for type. Adult, child etc.

basically my plan is to track a tickets availability by the dates it has. If xx user wants to buy a ticket for YY date, check to see if it is available for that date. if not then its sold.

So what I'm wondering is, whether I partition this into 2 or more tables, or simply do it all in 1 table
because we're talking potentially thousands upon thousands of entries and I obviously want things to be somewhat optimal
 
so a purchasable unit will be a event/seat/date instance
 
Yeah, basically my plan is to create a ticket for each section seat and row, and then correlate availability based on the stored dates, and price by the stored ticket types.
And my thought is, that it might be too much for 1 table
but 2+ tables you get the ugliness of queries with joins etc etc
 
4:39 AM
there should be at least an event table and a ticket table.
 
ugliness of joins?
that's the point of a relational db
 
joins are the beauty of a rdbms
 
there is a separate event table
tickets relate to events and venues.
 
morning
 
@Hybridwebdev So far that seems like the sane way to do things
@kelunik o/
 
4:41 AM
@Orangepill \o
 
@Orangepill sorry, which? going with 2 tables and separating the dates or 1 table with everything
 
@Hybridwebdev 2 tables at least... possibly 3 if you want to separate the venues as well
 
@Orangepill naw, the event and venue fields are just references really. They'll be ID's that associate to the venue/event tables when I need to pull up related data, such as address etc etc
the only thing that really has me thinking about going the 2 table route, is the fact that the dates could potentially be in the dozens if not hundreds. Which means a LOT of data and performance is obviously a concern
 
lots of data is what a database is for, it shouldn't pose an issue unless you are in the 10s of millions
 
other option would be to create a unique table entry for every set date but that * the number of available seats would be astronomical. Say 20 dates * 30,000 seats would be 600,000 entries just for 1 event
 
4:47 AM
I wouldn't do that... partitioning your tables out like that will cause more headaches then it is worth.
 
that's why Im taking my time planning this. To avoid headaches :)
 
two tables at least ... one for events and one for tickets.
 
@Orangepill I appreciate your insight
 
if you add an additional table for venues you can have something to hang the available seats for a given venue off that way your tickets table would only have to reflect the tickets that are sold instead of all possible seats.
 
yeah, the venues have settings for setting up seating by section -> Row -> Seat, just like a traditionjal venue is setup
 
4:55 AM
so the seat, event and ticket type will all participate in the determination of the price of the ticket?
 
yeah
the section and row is just a method of groupidng
grouping
 
that's a bigger argument for there to be a "venue" and "seating" table as well
 
5:13 AM
Goodnight ... I have to get some sleep.
 
5:24 AM
@Orangepill 'night
 
5:41 AM
Parameter binding is not for binding the name of column
 
In a rear facing seat for this flight... should be interesting.
 
Anonymous
@nhahtdh The whole query doesn't make sense.
 
moin
 
morning
 
Anonymous
 
6:08 AM
1
Q: How should I be using Google oAuth 2.0?

NubProWhat I'm trying to achieve is to allow anyone to login to the site and only certain registered user with permission are allowed launch the "Tap this button..." The thing is, I'm very uncertain as to how to verify whether the user is logged in and has legitimate token to access the button. Should...

 
Abe
6:33 AM
morning o/
 
6:54 AM
 
Abe
@LeviMorrison also, i wouldn't remove LSB, it is useful for static fields, rather i would remove static methods
 
I only even found LSB useful for one thing: constants. Even now I think I might try things differently.
 
Abe
constants? - constants can't be overriden
 
LSB?
 
Abe
class A{ const A = 1; }
class B extends A{ const A = 2; } // error
@kelunik it's not a drug! :D late state bindings
 
7:07 AM
no drug :-(
 
Abe
:D
 
Late static binding
static:: 3v4l.org/TEF7c contrasted with self:: 3v4l.org/ZteKv
I've found it useful for plugin architectures, other devs can add their own child class that the base class can then use.
 
there is a website, that we set our DNS in it for increase the speed of loading. the name of that site is something like this: fleur-cloud, anybody know what is the name of that site ?
 
Abe
@Jimbo WTF?
 
@Abe WTF what?
 
Abe
7:21 AM
a constant, not constant
 
?
 
Abe
i was expecting it to behave like this ^
 
Different for interfaces and classes I guess :-)
Welcome to PHP :P
 
Abe
god almighty
i wouldn't redefine a constant though @Jimbo why not using a static field instead?
 
7:25 AM
@kelunik ow tnx
 
@Abe Interfaces can have constants? TIL
@Abe I don't see a problem with it, since you can always use the class name to access the constants.
It's basically the reason why final on static methods in Java doesn't make sense, because a sub-class can always just declare a method with the same signature, it's not overriding it.
 
Abe
solution: avoid constants and static entirely xD
 
@Abe That's not a solution. ;-P
 
Abe
when things feel messy, better not using them. often there are alternative solutions. for instance static is almost entirely redundant with plain oop
 
7:38 AM
I have some classes, they are need to database, so I need to use 'database-connect' in the all of them ? there is not any better approach ?
 
Abe
@Sajad you inject the database handle within those classes
class A{ function __construct(PDO $db){} }
class B{ function __construct(PDO $db){} }
 
@Abe I just don't use statics :) It's a constant, the class that's overriding will have a constant value, it's intentional
The aim of a static variable is to contextually show that a variable is to be accessed without requiring instantiation of a class
I don't write my code like that, you either instantiate it or get f* :P
 
Abe
@Jimbo don't like that :P if php allows to do it doesn't mean it's correct. not that other languages did it right...
 
It's for dynamically instantiating classes. At one point there will only ever be one of these objects existing that extend from that base class, therefore the constant does indeed remain constant. Just allows the base class to know the context of the extended instantiated object
 
@Abe I see, tnx
 
Abe
7:46 AM
@Jimbo constants are inherited by child classes, so we shouldn't be allowed to override them. if they weren't inherited you'd be right. this is just my opinion though
 
You can always remove the constant from the parent (abstract) class, it works as a 'default' in case the child class doesn't declare one, although this can easily be done in code also. I put it there with an /** @override */ phpdoc so that future users can see to do it in their own class. It doesn't have to be there.
 
Abe
abstract const FOO; :)
i would rather have that :D
 
I think we can actually
I just haven't done that, and possibly may do in the future :P
Well, we can in HHVM anyway :(
/cc @DaveRandom What do you think about abstract consts
 
Abe
does it work in hhvm? i'm not entirely mad then :D
 
According to 3v4l, there's no errors I can see
 
Abe
8:07 AM
as far as i can tell, i don't see nothing wrong with that
 
which one is faster ?
SELECT id,subject,byA,matnF,source
FROM hadith WHERE MATCH (subject) AGAINST ('$q*')
UNION ALL
SELECT id,subject,byA,matnF,source
FROM hadith WHERE MATCH (matnF) AGAINST ('$q*')
LIMIT $j,10
 
OR
 
SELECT id,subject,byA,matnF,source,MATCH (subject) AGAINST ('$q*') AS rel_subject, MATCH (matnF) AGAINST ('$q*') AS rel_matnF
FROM hadith WHERE MATCH (subject,matnF) AGAINST ('$q*')
ORDER BY (rel_subject*2)+(rel_matnF) desc limit $j,10
 
Abe
union is certainly slower. also if $q is a php variable you should be using prepared statements or escape it
 
@Abe yes, I will use prepared statement, but, are you sure union all is slower ?
 
Abe
8:12 AM
yes, at least in mysql
 
@Sajad Just test it.
 
please take a look at SELECTstatement, there is two MATCH - AGAINST in the second query
@kelunik how can I test a query speed ?
 
@Sajad Just measure the time it needs to execute it?
 
yes
 
MGE
hey, hello everyone. I have a question. I'm sending dynamic dates through a form, and I have date_0, date_1, date_2, date_n. How can I get all these fields via received POST?
 
Abe
8:21 AM
$_POST['date_0'] ?
 
MGE
yes, but how can I know how many date_number are sent?
because that field is generated dynamically
 
Abe
<input name="mydate[]"><input name="mydate[]"><input name="mydate[]">
<?php
var_dump(count($_POST['mydate'])); // 3
echo $_POST['mydate'][2];
 
=====================================================================
TIME END 2015-08-29 08:28:09

=====================================================================
TEST RESULT SUMMARY
---------------------------------------------------------------------
Exts skipped    :    0
Exts tested     :   26
---------------------------------------------------------------------

Number of tests :   23                20
Tests skipped   :    3 ( 13.0%) --------
Tests warned    :    0 (  0.0%) (  0.0%)
pretty good ...
@NikiC got any spare time to help with the reference failure ?
 
I'm trying to parse this feed: http://feeds.finance.yahoo.com/rss/2.0/headline?s=AAPL&region=US&lang=en-US using xpath, but when I use this query to get the links: $links = $xpath->query('//channel/item/link'); and print_r($links->item(0));, I get this:

DOMElement Object ( [tagName] => link [schemaTypeInfo] => [nodeName] => link [nodeValue] => [nodeType] => 1 [parentNode] => (object value omitted) [childNodes] => (object value omitted) [firstChild] => [lastChild] => [previousSibling] => (object value omitted) [nextSibling] => (object value omitted) [attributes] => (object value omitted) [o
 
MGE
@Abe nice!
thank you very much
 
Abe
8:31 AM
yw
 
8:46 AM
I got a strange problem ....
all those iterator tests segfault in make test, but when I run them they are okay ... ini settings all same, can't make em crash
 
9:01 AM
Is something like <script type="application/json"><?= json_encode($user) ?></script> safe?
 
9:18 AM
o_o
what does that script type even do?
 
you need it.
 
@ScottArciszewski I want to inline two API calls directly into the page.
 
user895378
morning
 
how to count the number of results of a query ? (I need to know it for paging, if the result is more that 15, then I create a "see more" button)
 
@Sajad WHERE id >= ? LIMIT 16 and if there's a 16th result, use that as cursor for your next page.
 
user895378
9:32 AM
@kelunik where does $user come from?
 
@rdlowrey $user or $rooms would be the API query results, so untrusted data.
 
@kelunik I need to a separate query just for checking the overflow results ?
 
user895378
Is that the full contents of the http response?
 
json_encode escapes by default all /, so </script> shouldn't be an issue, but I'm not sure.
@rdlowrey I would take an internal shortcut, but yes, json_encode($user) is exactly the body of an API result.
 
user895378
Well assuming you send the right Content-Type: application/json header then I don't know how a browser could get confused.
 
9:37 AM
@rdlowrey No, I want to inline it into a regular text/html page, so I can just use the API result from the already delivered HTML instead of making two API requests.
 
user895378
Okay, well I'm hesitant to say "oh yeah you're 100% fine" ... I need to do some googling because I don't want to give you bad advice :)
 
user895378
But you probably want to use @ error suppression on the encode call and check for a false result just in case the data is bad
 
mornin'
 
@tereško morning
how can I echo one less than ever in foreach($sth as $end){} (for e.g. if $sth = 16 then echo just 15 items)
?
I don't need to the sixteenth element
Only fifteen first items
 
that's something you have to figure out on your own
there is no "magic method" taht you are missing
be a developer, come up with a solution
 
user895378
9:46 AM
@kelunik I can't find anything to suggest that would be unsafe. So ... assuming you're using encryption to prevent a MitM replacement of the actual raw data in transport and you're using json_encode() at the server I don't know how something like that could be exploited.
 
user895378
@tereško morning
 
o/
 
there is a way, I can use a condition in loop. if (end[16]){break;}
but I don't want to use if() in loop
 
.. because you are afraid of ifs
 
I afraid of condition ! a condition which needs to check for each time
 
9:51 AM
/me walks in and kicks some stuff, then leaves
 
@Sajad could you please stop with this bullshit?
 
@tereško I don't know the mean of 'bullshit', but ok, I stop.
 
what are you trying to optimize is +/- 0.001s
 
1 mili second is the time of executing my query ...
 
Abe
9:54 AM
@NikiC how about Closure::apply() ? same as call, but not variadic
i hate variadics :P
 
yes, and that is the combined "optimization", that you might get, if you somehow stopped using IFs
it is worthless
 
user895378
@Abe yay me too!
 
Abe
:P
 
user895378
@JoeWatkins o/ have a nice weekend :)
 
@tereško I think my main problem is Scrupulous×
 
9:56 AM
what?
 
I'm obsessed in coding !
 
you are doing it wrong
 
Abe
yay! no more reflection for package-private stuff!

(function(){
Foo::$baz = "aaa";
$this->lol = "bbb";
})->bindTo($x, Foo::CLASS)();

loving this
 
first time you need to make the code work
second you need to make it readable
 
10:00 AM
@tereško working is not my target, best working is what satisfied me ..
 
as if it's not hard enough to find bugs ...
 
@Sajad and you would determine "best working" based on what exactly?
if you don't have a baseline, how can you know that something is better?
programming usually is iterative process
 
I just know using a If(){} statement in the loop is not a good thing ...
@tereško yes it is
 
@Sajad you "know" wrong
 
@tereško maybe ..!
 
10:03 AM
and someone need some ass kicking in this channel for poisoning your mind
 
user895378
I hate when code mixes things like APC_RUNLOCK and APC_RLOCK ... how is someone without familiarity on the library supposed to tell the difference without seeking out the macro definitions :(
 
:-)
 
user895378
Presumably "rlock" means "read lock" but who knows
 
user895378
More and more I just want people to write code that's painfully explicit so I don't have to go hunting to find out what things do
 
@Sajad it's not actually funny
I know that it was fault either of @Ocramius or @Orangepill (I suspect the latter)
 
10:05 AM
@rdlowrey presumtion correct ... but only one kind of lock actually does rw locking, so most of the time it's just lock ...
 
@tereško see, suppose my loop wants to run 100 times, so if I use a IF (){} statement is this, the means is I have 100 IF (){} statement!
 
Abe
@rdlowrey also, it looks like apply() could have a second parameter as in bindTo/bind
$closure->apply($thisVal, Foo::CLASS, $arguments);
something like this
 
IF, at assembler level is a single instruction
same way as "value assignment" is a single instruction
 
You are saying this was unlikely
IF is a Comparison
 
10:10 AM
@tereško look, I know you know more than me so much, but If I use IF () statement in my codes, I can not sleep !!
5
 
then you are stupid
IFs are not evil
 
user895378
nested IFs might be evil :)
 
ok, If I can not solve my problem from another way, I will use IF statement
@rdlowrey IF in FOR is not evil ?
 
user895378
Nothing is either good or evil but thinking makes it so :)
3
 
well whatever evil happens to be, premature optimization is the root of it
 
user895378
10:14 AM
^ that
 
user895378
Write code that's explicit and easy to understand that you can test.
 
user895378
Optimize later.
 
Abe
with your current skills you should just worry of getting things working so you can grasp the big picture @Sajad
 
any of the picture, really
 
Abe
yes
 
10:19 AM
@Abe I did not get your point :-)
 
Nested ifs can frequently be changed to early returns and defensive programming
 
@tereško please take a look here and tell me my approach is acceptable for you ..?
 
Abe
with your current level of knowledge, you should only try to put things together, so that you can get most of programming with the minimum effort @Sajad
 
I would use a while statement instead, with fetchRow()
 
@Abe ok
@tereško so ? I need to remove last element of array, using of while statement with a fetchrow() is not my answer ..
 
10:24 AM
I will not write code for you
 
@tereško I don't want code, I want a algorithm, and by the way I found it
foreach (array_slice($colors,0,3) as $value) {
    echo "$value <br>";
}
 
stop googling for "algorithm"
write your own code
 
@Abe ow, also you solution is fine
@tereško well, this is my answer: array_slice()
It will remove the last key of my array
 
oddly enough, it actually isn't the answer
 
10:28 AM
I think you don't know what I wanted ...
I need to know: when should I create a "see more" button for the results of my query
so my results in a page is 15
and my query is limit 16
so I need to check if last element exist, so I should create a "see more" button
and then I need to remove the last element, because I want to show just 15 results in one page
actually my problem is related to paging
 
PDOStatement is not an array
 
$sth->execute(); but $sth is a array
@Abe please add you answer to my question, I will give you +1 up vote
 
Abe
thanks but i don't care of rep :P
 
@Abe ok, I don't give you +1 vote up, but please add your answer ! I
 
@Abe How does your dynamic class extension work now?
 
Abe
10:40 AM
@kelunik i had to use evil() for other reasons. i also tried get_class(new class(){}) but i didn't notice significant performance improvements. will test more later
 
@nikita2206 hey, took some time to squash the old drafts about the callable types RFC and made this partial wiki.php.net/rfc/callable-types
 
user3883753
bonjour
 
@tereško oh, WTF, it is not a array ... so how can I check the number of result ?
 
19 mins ago, by tereško
oddly enough, it actually isn't the answer
 
@tereško sometimes you are 1 step ahead ...
 
@tereško Fuck !! the answer was just this: rowCount()
thanks
I used fetchColumn() so far
and it reduces 1 rows !!
 
read what the method actualy does
you must stop that "it's magic" attitude
 
ok
 

« first day (1778 days earlier)      last day (3161 days later) »