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

11:01 AM
I've just seen a one-sentence message from Lester, this happens once in a lifetime news.php.net/php.internals/87993
 
Short closure syntax reminds me of Haskell
I think it was Haskell anyway - may have been one of the other languages we dabbled in at uni
 
11:30 AM
mornin'
 
Anonymous
@tereško o/
 
salam
 
@AbrarKhan are you from Iran, right ?
 
Pakistan
 
"salam" is Pakistani ?
 
11:35 AM
where u from @Sajad
 
Iran
 
shorcut we say salam
 
Interesting, "salam" is one of the main greeting word in Iran.
 
@Sajad it's part of "salam aleikom". A general greeting form for muslims.
Morning
@edward unclear, I would read:
44
Q: Reference: mod_rewrite, URL rewriting and "pretty links" explained

deceze"Pretty links" is an often requested topic, but it is rarely fully explained. mod_rewrite is one way to make "pretty links", but it's complex and its syntax is very terse, hard to grok and the documentation assumes a certain level of proficiency in HTTP. Can someone explain in simple terms how "p...

 
11:51 AM
@HamZa interesting
 
Add to fav :P
 
Salaam = As-salamu alaykum
Which mean May Allah's peace , mercy and blessing be upon you
 
i am having a brain function problem at the moment, how would i select
 
hi all
 
time selected and time confirmed
 
11:53 AM
somebody please help me
 
grouped by date
and show total?
with 1 query?
SELECT time_requested,time_confirmed from request group by time_confirmed
 
i need to store data from pdf file to mysql database .Any idea?
 
Can someone help me finding the error in my code?
 
0
Q: What mistake I'm making while adding a new trigger on a MySQL table?

PHPLoverFollowing is the trigger I've written : CREATE TRIGGER `test_BINS` BEFORE INSERT ON `phpfox_user` FOR EACH ROW IF new.`full_name` = '' THEN SET new.`full_name` = NULL; END IF; END; Following is the screen shot of the same: Following is the image of error message that came : Please somebo...

 
@sguetsch enable error reporting
@user3165482 total of what?
 
11:55 AM
@HamZa how?
 
@sguetsch google it
@Arundivakar google "PDF parser php" the rest should be easy
@sguetsch what's the error saying?
 
HamZa PHP Fatal error: Only variables can be passed by reference in /media/sf_web/dev/inveda/ibs/modules/ima/vertragswerke/system/anbieter/doubletten.php on line 26

Line 26: if (similar_text ( $rows [$i] ['name'], $rows [$j] ['name'], $prozent >=90 )) {
$query = new data_DataBaseQuery();

$SQL = "Select name from ima_supplier";

if ($query->doQuery($SQL) && $query->num_rows()) {
$rows = $query->fetch_all();

$anz = count ( $rows );

for($i = 0; $i < $anz; $i ++) {
for($j = 0; $j < $anz; $j ++) {
if ($i !== $j) {

if (similar_text ( $rows [$i] ['name'], $rows [$j] ['name'], $prozent >=90 )) {

$doppelt = array($this) ;
}
}
}
}
echo $doppelt;


}

}

Full code
 
@ircmaxell Totally agree and never was my intentiion… just yes/no and that'll be it.
@ircmaxell hmm, you need to explain me that…
@ircmaxell The block mode is, because the partial application mainly. It ain't not replacement for traditional Closures...
 
well im trying to draw a chart, based on values,
im needing to plot the total requests made by the total requests confirmed

my current statement is SELECT time_requested,time_confirmed from request group by time_confirmed
but this isnt what im looking for and i cant think logically at the moment my structe looks like this

id bigint(8)
username varchar(255)
phone text
goodorbad tinyint(1)
requester varchar(255)
time_requested timestamp
confirmed smallint(1)
denied smallint(1)
who_confirmed varchar(255)
 
There's something fishy in "if (similar_text ( $rows [$i] ['name'], $rows [$j] ['name'], $prozent >=90 )) { "
Shouldn't it be something like this:
if (similar_text ( $rows [$i] ['name'], $rows [$j] ['name'], $prozent) >=90 ) {
Oh, I see... Just break it in two:
similar_text ( $rows [$i] ['name'], $rows [$j] ['name'], $prozent);
if($prozent >= 90) {
also, it's a pain in the brains if the code is not written in english
 
12:04 PM
@HamZa yep, now it works. and yes, i forgot to change that. sry about that. bat thank you for solving this problem. now i have the little problem, that the echo aly says "array" instead of the names that are similar. i will edit my code to english. damn, i can't edit it anymore
 
@sguetsch use pastebin or gist.github.com
 
@sguetsch $duplicate is an array, so use var_dump() or print_r() instead of echo
 
@HamZa Aw, damn :D Thx^^
 
12:11 PM
@user3165482 what values? Maybe use COUNT()? Not sure if that could get you a graph though...
 
Abe
12:23 PM
@ircmaxell how would algebraic types work? i'm trying to understand what's their actual purpose but anything i find is about haskell, which makes quantum mechanics an easy topic :P for instance a tuple doesn't look to be more than an immutable array
 
user1994804
Hi guys, I was wondering if there is any speed benefit to not starting and stopping php?
 
user1994804
I know the following would be best
 
user1994804
<?php
include 'somefile.php';
include 'anotherfile.php';
?>
 
user1994804
but, is that speedier than;
 
user1994804
<?php include 'somefile.php'; ?>
<?php include 'anotherfile.php'; ?>
 
12:27 PM
@YourAdrenalineFix What bike you got? Also, as for including files, you should look at autoloading so that when you ask for $x = new ClassName it automatically finds the ClassName for you without you having to include it. The only thing you do, with composer for example, is at the beginning of your script do a require_once __DIR__ . '/vendor/autoload.php'; and that'll then let you autoload anything
Also, you don't need to ?> at the end of your php scripts. Also, don't even think about the difference you mentioned :-)
 
user1994804
Im converting a bunch of pages from
<?php include 'somefile.php'; ?>
<?php include 'anotherfile.php'; ?>

to

<?php
include 'somefile.php';
include 'anotherfile.php';
?>
 
There's no point in that
Apart from it's more readable
 
user1994804
and was wondering if I should see speedier page loads?
 
Nope
 
user1994804
even though it is server side
 
user1994804
12:29 PM
Oh, ok
 
user1994804
Atleast it'll look cleaner ;)
 
What's the bike in your pic?
 
user1994804
I have a CR250 2 Stroke and a CRF 250X with a 276 kit
 
Looks like a crosstourer
Ah, cool
 
user1994804
Nah, Pure Motocross bike pictured
 
user1994804
12:31 PM
that pic looks so corny...
 
Nothing wrong with it
Just show more bike next time :)
 
user1994804
Looks like Im leaning back against a bike leaning away from me
 
user1994804
Im actually standing perfectly upright and the bike is leaning against my butt trying to push me fwd
 
Does anyone have a clue why my tutorial got a bunch of likes over the last 2 days? Was it featured somewhere?
 
@Abe unlike array it can hold different type for each of the element of the tuple. Arrays have one type for each element. That makes tuples more fit for different purposes than arrays.
 
user1994804
12:32 PM
rolls eyes
 
user1994804
Thanks for the input @Jimbo
 
Abe
@nikita2206 yep but it isn't like that in php already?
 
@YourAdrenalineFix Np
 
Abe
apart arrays aren't immutable
 
@Patrick depends what "a bunch" is. It was linked in a reddit thread, but I've no idea how much traffic that drove.
 
12:33 PM
@Abe it's not type-safe
 
Abe
@nikita2206 i don't get the difference :P
 
@Abe algebraic data types are all about types unlike PHP's arrays :)
They are strict, a tuple of type (A, B) means that it always contains A as a first element and B as a second element. PHP arrays are just lists/maps of anything
 
@PaulCrovella around 40 I think in 2 days, which is rather unusual
 
Abe
oooh i see now @nikita2206
 
user1994804
@Jimbo BTW, Do you ride or have an interest in off-road motorcycling?
 
12:39 PM
@Patrick Could be it. Here is the thread if you're curious.
 
@YourAdrenalineFix I ride, but not off-road. I try and avoid that :-) Few other guys in here are in the middle of their bike training
 
user1994804
Nice
 
Thanks =)
 
user1994804
How about everyone mention what kind of bikes they have?
 
I actually think the ternary operator is a nice analogy here. It’s a non-obvious syntax construct a newbie has to learn too. It’s a short-hand to write one line instead of three. It can be quickly ugly if you abuse it.
Same is true for this short Closure operator.
^ what do you think @ircmaxell ?
 
12:44 PM
the syntax discussion is less interesting than the semantics
 
@HamZa i think i have figured it out
SELECT COUNT(*) as total, DATE(time_confirmed) as date_confirmed, DATE(time_requested) as date_requested from request GROUP BY `time_confirmed`,`time_requested`

thanks :)
 
@PaulCrovella that's not a syntax discussion, but actually why we shouldn't just say no with the argument it'd be less readable.
@PaulCrovella Also, what about the semantics?
 
@Hamza
i lie i havnt, god dammit
 
@bwoebi implicit binding and return. Even the syntax points Thomas brought up regarding optional parentheses and braces are more interesting than the readability nonsense that's come up from everywhere else.
 
@PaulCrovella It is nonsense, but everyone brings it up :s
I'd like to have that discussion killed. I'm not going to reply to that, because we'd just turn in circles here.
To Thomas… the braces for the body… It's IMHO simple logic: something standalone is an expression => can be returned; a block isn't an expression => can't be returned.
The binding is actually necessary to make it useful at all. Only few Closures do context-less transformations…
 
12:55 PM
Hey guys. I'm just curious but do you write User stories yourself? Do you write tests yourself and do you generally test your product thoroughly yourself? I'm just trying to understand whether my expectation of a good company's developer workflow is too high.
 
Also, AFAIK the $1, $2, ..., $n discussion came up too here when I drafted it here, but that even I feel a bit uncomfortable with :-/ so used to named vars…
 
Yeah, he lost me at the $1, $2... stuff. I don't know I'm even with him on the bullet points he brought up, I just think it's the more interesting conversation.
The folk arguing about readability just took a knee-jerk reaction and aren't likely to change their mind on that point, regardless of counterpoints posed to them.
waste of time, imo
 
Agree. Hence I'm not replying
I'd just like to eventually leave a generic statement to all these arguing and be done with it.
 
I'm going to reply.....I'm old enough to criticise other people for being old.
 
@YourAdrenalineFix So @JoeWatkins is currently doing his tests amiright, has a chinese 125 atm? I got a '14 CBR600RR, @Gordon wants to get a naked XSR700 style bike
 
1:03 PM
I got a honda nsr125, and a z650 trike
 
@bwoebi heck, just read the thread again. Anyway, it's just ~3 people bringing the same "write only code" nonsense again and again.
 
@Danack Just to get it off your chest, or do you honestly expect it to do any good?
 
gave cruiser thing to misses @Jimbo
 
@JoeWatkins Haha, give her the crappy one, you get an NSR ;-)
I like your thinking
 
@marcio yup ;-)
 
1:04 PM
@PaulCrovella I will leave my exact motivation obscure for strategic reasons.
Which might be more obvious if the strategy works.
 
translated: "because fuck you, that's why"
 
@Danack Your bend over strategy works really well!
 
why you don't have this on your RFC:


> Most programming languages today have a "short form" closure or lambda syntax

HackLang: ($x) ==> $x + 1;
C++: [](int x) -> int { return x + 1; }
Java: (int x) -> x + 1;
Python: lambda x: x+1
Ruby: lambda |x| { x + 1 }
Rust: |x| x + 1
JavaScript (ES6): x => x + 1
C#: x => x + 1
Objective C: ^(int x) { return x + 1; }
 
stupid apcu taking up my time again ...
 
because, somehow, all other languages started to use write only code...
 
1:08 PM
@marcio and PHP wants to be better than these… argument invalid!!
 
@bwoebi I know you're busy, but got any time to look a crash for me ?
 
@bwoebi not an argument, merely showing what other languages did is a good thing on RFC
 
@JoeWatkins yeah?
 
build php7 with --enable-zend-signals and run any apcu test script, they all crash in a really strange place, not sure why
I think maybe zend_signals is overwritinng a signal it shouldn't be, but dunno which/what/why
I hate signals ...
 
zend signals? phew, no idea of that^^
 
1:10 PM
me neither
 
Probably Dmitry is the only one to help you here
 
yeah probably ... I ask because you're good with a debugger, you might see something I don't in the trace ...
it looks normal to me ...
 
okay, will give it a try…
 
So is zend_singal just a wrapper for pcntl signal handlers?
 
1:15 PM
it basically blocks signals at certain critical points ... really badly ... it was only apache that required it I think
 
Anonymous
@bwoebi why not include the short closure in 7.0?
 
@samayo too late
 
so it wraps and then decides when they should be called ...
 
Anonymous
it's @bwoebi fault :D
 
which is ... not really very sound thing to do ...
 
1:16 PM
@samayo yeah, feature RFC freeze was in April or so…
@JoeWatkins btw. I get no segfaults
 
wuuuut
php -i | grep Sig
to be sure
sometimes when I don't vcsclean it doesn't switch off/on ?
 
Zend Signal Handling => enabled
 
oh crap
osx ?
 
yes
 
/* this may not be safe to do, but could work and be useful */ lol
That code is just scary.
 
1:19 PM
@Sherif where did you find that?
 
in zend_signal.c
 
It's above the debug output in zend_signal.c
 
not safe, can't alloc in sighandler
 
lol
 
signals > 32 are discarded, which is going to lead to fun someday ...
 
1:20 PM
Yea, this is not very reliable code.
 
I dunno if now is a good time to tear it out though
 
Probably not
 
who is the apache goto, I dunno if it's even required
 
Rasmus?
 
@Jimbo @YourAdrenalineFix actually I am heavily undecided what I really want for a bike, but the XSR700 seems like the most sane choice for a start after not riding a bike in 20 years
In addition to the XSR700 I'd also like a Harley Nightrod, Harley Iron 883, Yamaha Vmax, Indian Scout, Ducati Scrambler or Ducati Monster Evo 1100 Diesel … or the upcoming Harley E-Bike that sounds like a jet fighter (at least in the commercials) :)
 
1:25 PM
diesel motorcycle ?
 
and a couple triumph cafe racers look quite nice, too
 
oh oh
 
@JoeWatkins no, it's just branded by Diesel, the clothing company. I couldn't care less for having the Brand name and logo on it, but the bike in general looks totally rad
 
yeah I looked
is sweet
monsters are popular here
also popular, baby monster-ish ...
(don't like front, rest is alright)
 
Abe
i need some help folks. i'm trying to detect logic errors in logic expressions such as ((baz && foo) || foo) but i'm failing doing it efficiently. or even (foo && (foo || baz)). should i just check if an expression contains the same operand multiple times? this though, it's not so wrong ((foo && baz) || (foo && bar)) but i could force it to be written as (foo && (baz || bar)), so that foo appears only once. any hint?
 
1:29 PM
well .... apcu is still broken ...
 
@Abe "detect logic errors " How do you define an error?
 
hi friend i have face some problem
 
Abe
@Danack ((baz && foo) || foo) this lacks of logic
 
in php
 
@Abe what does "this lacks of logic" mean?
 
1:33 PM
@Abe I think sonarqube might be a good tool to help you with this
 
(and this is leading somewhere...)
 
Abe
@Danack i want to detect expressions that are likely programming mistakes
 
When I try to send Push Notifications I get this error: "Failed to connect: 111 Connection refused",
plz help me
any friend
my Code <?php
if($_POST['message']){

// Put your device token here (without spaces):
$deviceToken = '9ca1d1ab f55b9ef8 7573ae79 e005939d 78e0b9fb 6976513c afd712f3 93b73d71';
// Put your private key's passphrase here:
$passphrase = 'LetsHang';

$body['aps'] = array(
'alert' => $message,
'sound' => 'default'
);
// Put your alert message here:
$message = json_encode(stripcslashes($body));

$ctx = stream_context_create();
stream_context_set_option($ctx, 'ssl', 'local_cert', 'LetsHang.pem');
stream_context_set_option($ctx, 'ssl', 'passphrase', $passphrase);
 
@Abe You are really bad at answering questions sometimes, and in this case by avoiding answering the question you're avoiding thinking about your problem in a particular way that would be helpful, so again: how do you define a 'logic error'.
@Satyam please use pastebin.com or other site for posting chunks of code.
 
Hey, i have a question. Can I print the result of an interation in an ajax field, then iterate again, print, iterate, print...?
 
1:36 PM
@Satyam Just a tip: whenever you're in a situation where you should say "please" then you're in a situation where you should take the time to spell it out completely.
 
/and he never said please ever again.
 
@bwoebi Any ideas about fixing bugs.php.net/bug.php?id=70397?
 
Well, technically he said "plz"
 
Can i haz chezeburgerZz? pl0x!
 
Prob is that the ::call creates a zend_function copy on the stack, which lives shorter than the generator object
 
1:37 PM
 
Probably should just create a normal closure object if the method is a generator? To avoid having to special case this in other places
 
@Abe you want to check for redundant conditions?
 
Abe
@Danack i get nervous every time i speak with you :( logic error as in a logic expression that is likely to be a programming mistake. it's not php code. doesn't that answer it?
and i'm not avoid answering anything. at least not on purpose
@marcio redundant yes, that are likely mistakes
 
1:41 PM
@Abe No....you're thinking at the wrong level.....you're thinking about intention.....just think about code. The examples you gave have a property about them; they're invariant to one of the inputs. I'm guessing that's what you mean by a logic error that some of the input doesn't result in a change in the output.
Which you can just test for by testing all possible inputs....
You don't need to analyze the intention - just the actual code...
 
@NikiC Sure that this is the issue? I see the segfault in the FETCH_OBJ_R handler which is before the first yield…?
 
And you can do that by testing all possible inputs and then looking at the outputs...
 
@abe expanding the paths might shed some light fy:
    if ((baz && foo) || foo)
    -----
    if (baz) {
       if(foo){

       }
       else if(foo){

       }
    }

// can you spot how to analyze it now?
 
@bwoebi Ah, really? I ran it through valgrind and dtor_storage accessing op_array is the first invalid cond mov I get
 
@NikiC sec, running with valgrind too…
==22719== Invalid read of size 8
==22719==    at 0x1005BBEA2: zend_generator_resume (zend_generators.c:669)
==22719==    by 0x1005BC8D5: zend_generator_ensure_initialized (zend_generators.c:732)
==22719==    by 0x1005BC98D: zim_Generator_current (zend_generators.c:797)
==22719==    by 0x100606E30: ZEND_DO_FCALL_SPEC_HANDLER (zend_vm_execute.h:835)
 
Abe
1:46 PM
@Danack with testing you mean? by "brute forcing" all possible inputs? :D
@marcio that helps
 
Yes. I hear that computers are fast these days and for the example you gave calculating the result of all four things should be reasonably fast.
 
Are you getting something else? @NikiC
 
Abe
i wasn't being ironic @Danack :P
i could do that
 
==26129== Conditional jump or move depends on uninitialised value(s)
==26129==    at 0xB53414: i_free_compiled_variables (zend_execute.c:2010)
==26129==    by 0xB5342F: zend_free_compiled_variables (zend_execute.c:2027)
==26129==    by 0xB2D411: zend_generator_close (zend_generators.c:90)
==26129==    by 0xB2D6EB: zend_generator_free_storage (zend_generators.c:175)
@bwoebi That's what I get
 
I get that too, but much later
 
1:50 PM
@bwoebi Your line is also accessing ->func though, so basically same problem right?
 
Abe
@Danack do you usually use this kind of approach with testing?
 
yeah, but that's upon the first resume though…
 
@bwoebi Ah wait I'm running with zmm
 
@Abe tip: that "expansion" could be wrong, you may try to find a way to do it right (in case you think it's wrong) ;)
 
good morning
 
1:51 PM
==26140== Invalid read of size 8
==26140==    at 0xB4F604: zend_assign_to_object (zend_execute.c:1092)
==26140==    by 0xB8CBCD: ZEND_ASSIGN_OBJ_SPEC_UNUSED_CONST_HANDLER (zend_vm_execute.h:23578)
==26140==    by 0xB54CA4: execute_ex (zend_vm_execute.h:406)
==26140==    by 0xB2F0DD: zend_generator_resume (zend_generators.c:688)
 
@Abe No - I tend not to write code that combines logic with other logic.....so don't need to test logic like that. But just brute force testing is definitely the correct thing in some circumstances e.g. randomascii.wordpress.com/2014/01/27/…
 
Now without zmm
 
@NikiC that's the second failure I get.
The first failure is the one above with:
==22725==  Address 0x10558d2d8 is on thread 1's stack
==22725==  200 bytes below stack pointer
 
Abe
@Danack because i have the feel i would write broken testing code xD but that's something i could do on this occasion
 
As I was trying to suggest - the problem you are trying to test for I think is a mechanistic one, i.e. can be tested with mechanistic means, without understanding what is actually going on. You were thinking about it 'heuristically' i.e. trying to understand the code - I can't see any benefit in doing it at the higher level, as brute-forcing it at the input/output level is what you actually want to test for anyway.
 
1:54 PM
@NikiC yeah, it's the same issue though…
 
As that's the definition of your 'logic error'; when a different input doesn't result in a different output...
 
mornign
 
Abe
@Danack makes sense
 
Anonymous
@PeeHaa What time do you call this?
 
Morning, duh.
 
Abe
1:55 PM
@PeeHaa o/
 
morning
 
@Danack I don't think this is a case for brute force at all, he basically wants en.wikipedia.org/wiki/Control_flow_graph
 
@NikiC It's enough to copy the zend_function into emalloc()ed memory when a generator is created, I think? … oh, we'd then leak it.
 
@bwoebi in which case we'd have to special case freeing of it, right?
 
yeah
 

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