« first day (1311 days earlier)      last day (3862 days later) » 

0
A: PHP : How to know if my query is success or not?

RamkiTry this code: $query_search = "insert into tbl_user (prenom, nom, ville, username, password) values ('".$prenom."', '".$nom."', '".$ville."', '".$username."', '".$password."') "; $query_exec = mysql_query($query_search) or die(mysql_error()); if($query_exec) { echo "sucess"; } else { echo "...

lolwut
or die() and then a comparison, lol
@DamienPirsy You never know... — Leri 26 secs ago
Had to say that. ^
13:20
Do we have some flying dutchmen in the room?
@PeeHaa you speak Dutch right?
Rather, I'm looking for people who know German, so I guess I'm looking for @Gordon
Bob knows German too.
@SecondRikudo jo
@PeeHaa Do you know german?
Can you tell if the language sung at the beginning of this is german?
@SecondRikudo Some
@SecondRikudo I don't have speakers atm :(
Nope.
13:26
@webarto Do you recognize the language?\
Japanese, maybe?
From German to Japanese. :o
German language isn't this melodic.
@webarto That's not japanese.
I don't think it's any of the European languages too.
13:32
Maybe, Afrikaans, it sounds like Dutch. I don't have speakers. Just trying to help...
It sounds like you can hear some German words, but it's not German for sure.
Engrish motha-farker, do you speak it?
Probably Engrish.
Like Geddan.
Just to reiterate, not twig users here? :P
13:37
pinging in case you didn't see it - definitely german http://erruuu.blogspot.co.uk/2013/06/lyric-attack-on-titantk-0n-ttn-shingeki.html "ist das der Zerstorer oder der Schöpfer?
Mit der Glut des Hasses schwenken wir die Schwerter"
> ist das der Zerstorer oder der Schöpfer?
Mit der Glut des Hasses schwenken wir die Schwerter
Ist das unser Schicksal oder unser Wille?
Wir werden kämpfen, bis dieser heiβe Wind unsere Flűgel nimmt
It starts from here, but half of the words are not pronounced correctly.
Or not at all.
@Danack Thanks
@webarto It could be a mix of Japanese and German
Both opening songs have Japanese and German mixed in
Yeah, I could hear only few words, like "unsere" and "Flugel", etc. but pronunciation was Japanese for sure.
Morning
mornin'
13:51
Morning
Afternoon
morning
nignronm
hmm ... nice to see that are record label puts up a full album on youtube: youtube.com/watch?v=rmR0gkojHDs
just making sure: php didn't have an "undefined" value for uninitialize variable , right ?
Uglier php code but nicer templating. Will tidy it up once I am there. Twig has been good to me. But most importantly I stopped producing wankery.
14:00
@Fabien Never prefer front-end code over back-end code. :)
Heh. It'll be fine once I tidy it.
Besides it's mostly back-end.
@Danack next patch release is in mid-june
14:21
Does the 64 bit platform improvements rfc mean I don't have to worry about playing with large file sizes to the exact byte in both 32 and 64 bit
@Jimbo define 'playing' ?
@Danack I remember there was a problem with reading the exact filesize of a file in 32bit if it's bigger than 4GB?
@Jimbo 2GB
> Note: Because PHP's integer type is signed and many platforms use 32bit integers, some filesystem functions may return unexpected results for files which are larger than 2GB.
Shit is signed dawg
:-(
I know you can perform a HEAD request to get the filesize, but if it's local and you're on 32 bit, and it's larger than 4GB and you don't want to use the O/S to do it, you're screwed...
Yeap
14:32
Does it just affect PHP compiled in a 32 bit environment?
Would love some proofreading/factual correctness here:
@Danack ...or on Win
So just shitty platforms then...(obvious troll is obvious).
pretty much
I don't like writing code with a requirement of a 64bit O/S :(
14:39
And the results have been announced: hashguesser.appspot.com
2
Q: How to pass variables from PHP to JavaScript?

Second RikudoI have a variable in PHP, and I need its value in my JavaScript code. How can I get my variable from PHP to JavaScript? This question is intended to be an information source and a duplicate target. You are free to post answers but please don't post one liners. There are questions on this subj...

First JS canonical of mine ^
answer: you don't
@ircmaxell Sure you do. With AJAX.
Are you using XML?
@SecondRikudo well, I though we have sort of "canonical" post for that. Yet another "reference" .. Like I've said - we should use existing good answers instead of creating new references. I can't believe this wasn't answered
14:42
@ircmaxell Hardly.
@SecondRikudo then you're not using AJAX
@AlmaDo I was about to say just that I think
@AlmaDo Linked? I looked and didn't find, even with the help of the JS room.
@ircmaxell Yeah well, don't be nitpicky. This question is oriented towards noobs.
@ircmaxell E_MISSING_CONTENT_TYPE
> Kuba BÅ™eÄka
14:43
People who do var = <?=$var?> and don't understand why it sometimes fails.
clarity of communication is nit-picking?
@DaveRandom ARG
@ircmaxell lol that setup screwup from your side winner is awesome
@DaveRandom fixed
@PeeHaa that was the point. It wasn't a screwup. It just wanted to appear to be
Are facades (i.e. static factories) considered bad practice? I know Laravel took some flack for using them
@SecondRikudo we all know that js room is useless (:
Client::post() instead of (new Client())->post()
@ircmaxell How would you call it?
as for the answers.. hm, I think google can help
14:45
@ircmaxell do you think #8 would have fallen if the solutions hadn't been exposed?
Because I know a noob will say "AJAX" so I'd rather speak his language, even if not 100% correct.
@hohner if you're really doing (new Client())->post(), then there is no difference. Both are highly coupled. Instead, if you accept a Client object as a dependency to the class, then there is a huge difference (as it's far easier to mock a dependency, or switch it out, than it is to mock a static call)
feels really to good to finally have rdlowrey/Arya working. The DI is really good for the code.
@bwoebi eventually, if people didn't lose interest before it, yes
@ircmaxell well, nest md5 and sha1 100 times with concats etc. and nobody will find it. There's naturally someone which could have so much luck, but it's just improbable.
14:49
@ircmaxell there is no class accepting the Client object. It's a question of asking the end-user to either instantiate the Client first (and calling a normal method on it), or using static methods to simplify the process
@ircmaxell Easily forgotten when your first language is almost entirely covered by ASCII
@bwoebi That is stuff that will be easily found
@hohner static factories ARE NOT facades
As a matter of fact people do exactly that
@PeeHaa well, #8 was of that genre, just 3 times nested.
14:50
Even that one would have been found
@hohner the point remains about high coupling. If you like that kind of thing, Client::post() looks better
Saying "nest md5 and sha1 100 times with concats etc. and nobody will find it" is scary from a member of this room
@tereško facades reduce the complexity of an interface, right? How does a static method in this particular case deviate from the facade pattern?
God people still don't know that "facades" are terrible?
14:52
@hohner it's a static proxy at best. It doesn't fit the description of the purpose or implementation of a Gang-Of-Four Facade pattern
I really don't like static methods like this. But if I remove this usage, people will complain about how Client::post() is simple
so I just wanted a technical reason for removal
@ircmaxell thanks I'll give this a read
@hohner Just say it is deprecated in PHP :)
@bwoebi I need to write my blog post on it, but the point is that no, it's not really improbable. Because in order for it to remain secret, eveyrthing needs to work perfectly. Every developer who looked at it needs to keep their mouth shut. The algorithm needs to not leave traces around what it does (like some of the ones I had). The servers must always remain perfectly running. Any one thing fails, and pop goes the weasel...
@ircmaxell yeah, I completely agree here.
14:54
@hohner the issue with these are the coupling: you are bound/welded to the name of that class. The same applies to writing (new Client())->post() .. it doesnt solve the coupling issue
@tereško but does instantiating the class first get around this coupling problem?
if you are instantiating it at the same place where you are executing it: no
you are providing no separation
instead you should pass $client as a dependency
@PeeHaa That is actually relatively simply written, but just guess with some possibilities how we got hashes produced by something like … for ($i = 0; $i < 107; $i++) { $method = $i % 17 < 4 || $i % 3 != 0 ? "sha1" : "md5"; $hash = $method($str); for ($j = $i % 7; $j > $i % 3; $j--) $hash .= $str; $hash = $str; }
@tereško I don't know if you can enforce that kind of abstraction for consumers
That's the key: (new Client())->post() is identical to Client::post() from most points of view. However: function foo(Client $client) { $client->post(); } is quite different as it strongly reduces coupling, and results in a clearer picture of how and why a method works
@hohner can you explain what you mean by that line?
@bwoebi have you seen how APR1's implementation of MD5 (as used by Apache, crypt, etc) works?
14:59
@ircmaxell so if I'm an end-user who wants to execute a request, often I will just instantiate the Client and invoke a method. Or call Client::post statically. Most people will probably not use DI - i.e. foo(ClientInterface $client) { return $client->post(); }
@ircmaxell I just was talking about guessing the encyption method with knowing hashes. I really don't say that you should do something like that in real world…
If anyone who understands how passing variables by reference in a PHP extension is meant to work, and has time to review this function I would appreciate it. I'm not sure if I'm handling them correctly.
@hohner you say most people will probably not use DI, what makes you think that?
@ircmaxell because as soon as I mentioned dropping support for Client::post on irc, I had two people tell me how much they used it
@hohner Well, there are a number of reasons for that
but if you are really that concerned, you could do Lazy DI
15:01
@ircmaxell jup, such things. Problem is that you just hardly can guess what happens when these methods use other magic numbers... For every magic number more you have exponential growth of difficulty…
@bwoebi at the assumption of the rest of the stack being secure, I'll buy that
but that's a massive assumption
@ircmaxell That's why I'd always just use bcrpyt with a normal number of iterations and be safe…
@hohner well, it would be a B/C breaking change. Which would also mean a major version increment
0
A: How to pass variables and data from PHP to JavaScript?

Benjamin GruenbaumI'm going to try a much simpler answer: The core concept here is to understand the core flow of events when a page is served: First PHP is run, it generates the HTML that is served to the client. Then, the HTML is delivered to the client, after PHP is done with it, I'd like to emphasize that o...

@SecondRikudo
@tereško yeah it's a strawman proposal for a new public version - BC is not an issue
15:04
@SecondRikudo You didn't know?
@Naruto Hmm?
@hohner Check out these videos as well, especially this one
@SecondRikudo nvm, ignore me, i'm brainded today!
@ircmaxell will do. I'm basically looking for a technical reason to remove static implementations of methods that should be invoked on an instance
coupling shouldn't really be a factor because that depends on how a consumer implements the API. "Mocking is harder" is probably a good reason
@hohner Impossible to tell dependencies by looking at method signature. Hard to test in isolation. Hard to mock / swap. kittens die
15:08
@hohner you must also take a close look at the code. Usually the "static class" is just a magic wrapper, which acts as autoloadable namespace for global functions
Here's another awesome blog on the subject: kunststube.net/static
mixing responsibilities too. A "post" method should execute a request and return a Response - not instantiate and configure a client
@ircmaxell Ironically the page is named "static" :D
not ironicly
Oh it really isn't ironically.
Ignore what I said :D
15:09
Question. In regards to Auryn are there any notable performance hits using it? Or is it insignificant?
all these links are really helpful - thanks everyone
> Additionally, each reflection offers the opportunity to cache the results if you're worried about speed. Auryn caches any reflections it generates to minimize the potential performance impact.
@Fabien reflection in 5.5 are quite fast. Do a small benchmark.
@Fabien I highly doubt you would ever notice it
That caches thing reads more like something for people shouting reflection is sloooooooooow which is mostly BS
@PeeHaa It has to instantiate multiple objects depending on what you do
15:12
I see cache as option for optimization. If it wasn't there, you would have to rewrite the whole thing to apply said cache.
@bwoebi ?
honestly, 90% of web devs who create one off websites and are not really interested in programming doesn't need to care about coupling. @hohner if that's your demographic then you need to cater to them. (hide)
@andho You have 2 choices: mediate (pander to the lowest common denominator) or educate. Personally, whenever I see that choice, I choose educate. Because mediation will only hurt everyone in the long run.
@PeeHaa reflection is quite fast, but it is not so fast.
@bwoebi WHat do you mean by so fast?
I just stated it is not sloooooow in most cases?
@PeeHaa depends on to what you compare it.
...
@andho tHEY should not be called developers then. :)
code-monkies are not developers
3
I love that video ("Don't Look For Things"). re-listening to it now, and awesome sauce
15:27
yes, yes it is
Totally
wow that's not engish
@ircmaxell Looks like the 64bit thing worked out nicely now :)
@NikiC yup. Well done
what happened ?
15:30
@NikiC and thank you for taking the time to discuss with me :-)
One of the mails by dmitry also confirmed that with size_t only in zend_string the change for WP is 0.8%
So my numbers weren't a fluke. Was a bit afraid that I was testing some freak case and the difference for a real application might turn out altogether different
@tereško In terms of code, this is the conclusion: gist.github.com/dstogov/07fcbb60b1b585bcd290 - Minus propagating those changes through PHPNG
Namely: Make integers 64bit on Windows and make string length 64 bit as well - but don't change any other important areas
@ircmaxell Same here. Amazing what happens when people talk to each other :D
and leaving the array size 32bit ? what's with float ?
@NikiC Pfff talking. nooooob
Amazing what we can accomplish if we work together :-D
@tereško Array size stays 32bit, yes
15:35
@tereško Well, it's more nuanced than that. Yes, you can't have more than 2^31 elements in an array. But that doens't mean you can't have a 64 bit index in it (meaning that you can have a 64 bit index)...
that seems reasonable
@tereško Nikic made a very nice post explaining the changes - serverphorums.com/read.php?7,937474
@tereško What about float? We were already using double (64bit) everywhere
oh
as you probably can tell: I am not a core dev
yet.
15:36
probably never: I have no love for C and/or drama
Conclusion of the 64bit discussion: 64bit integers on Win64 (LLP64), 64bit string lengths, 32bit array lengths; integrated into phpng.
@NikiC Would it be worth clarifying that integers and string lengths will be native to the compile now (64bit on 64bit compiles, 32bit on 32bit compiles, etc)
> VI est un bon CMS. Il faut juste avoir le courage de l'apprendre (trop compliqué pour les débutants). Une fois maîtrisé, tout devient facile.
lol
oh wtf
This API returns a different structure if the result has more than 1 row for the same location.
@Fabien Java like api detected.
I'm out of vote for the day.
@ircmaxell btw, I wonder whether we can store 2^32 elements
Basically the issue with 2^32 would be that nTableSize overflows there
however, I already suggested that we might want to get rid of that one altogether
In which case we're left with 2^32-1 in nTableMask, which fits
actually
So that might work ^^
15:53
but even there, the 2^33 when moded against the mask would give a valid result
you just couldn't grow the table, meaning it wouldn't be an optimal structure for > 2^32 elements, but it should still accept them... Unless there's an internal counter somewhere I'm missing...
@ircmaxell The problem is that with the new implementation the maximum possible load factor is 1
because you're not allocating buckets directly?
you just can't go beyond that because the table is fully occupied
well and there's nNumOfElements being 32bit as well, of course ;)
I'm mainly wondering whether we can make that last bit usable ^^
well... It's not a hash table then, is it?
15:57
@ircmaxell it is
you can't load an open-addressing hashtable beyond 1 either
load factor > 1 is actually a very rare special case ^^
can any one please help me
well, then how is the maximum load factor 1? You can't add to the linked list of a particular bucket?
hey ircmaxell can you please help me
@ircmaxell there's no linked list anymore
@NikiC ummm... how is it a hash table then?
16:00
well okay, there still is a linked list, just implemented differently
1 message moved to bin
@user2754190 please summarize your issue without posting a link to a potentially NSFW site
@ircmaxell There's more than one way to implement an HT. The "standard" way to implement one doesn't use collision resolution lists at all
@NikiC I'm confused...
@ircmaxell I'm doing a bad job explaining this...
The new hashtable implementation has a bucket array of some nTableSize. You can't store more elements than that in it. If you need more elements, the bucket array is realloced with double the size and rehashed. The linked list for collision resolution is still there, but now it doesn't work with pointers to individually allocated buckets, but uses indices into the bucket array
Is this necessary to implement fast 0...n arrays? (packed flag?)
And to be able to convert them without major performance issues.
16:06
@bwoebi It's necessary for a number of reasons. Necessary to avoid allocations (damn slow), to avoid cache misses during iteration (damn slow) and to implement packed hashes as well ;)
does anybody know how to add modifiers to a grep command using regex? in PHP it's #^pattern#s
@NikiC I see, that makes sense :-)
And partially also to avoid cache misses during lookup - lookup is still random-access, but due to the buckets being stored compactly, that should still need less misses
@NikiC during sequential access in loops? okay
@bwoebi I mean hash-based lookup here
Iteration is sequential, but hash lookup goes through randomly-distributed collision chain.
16:09
ah okay
Making hash lookup sequential is hard if you need to keep order as well :(
@hohner What modifier do you want to use? (read: what behaviour do you want)
@NikiC how is performance of array_(un)shift now with the new packed HT compared to before?
@hohner the last 's' is a modifier ;)
@NikiC so couldn't insert (one which generates a collision) result in having to shift all the elements in that list down one?
16:15
@hohner # is you chosen delimiter, after the last one come the modifiers
@ircmaxell that list holds the order. A new element always goes at the end of the list
at the end of the list? then how do you know how to access the right bucket for the hash?
@ircmaxell that's the separate arHash array
arHash holds the head index of the collision resolution list
Ahhhhhhh
which is allocated
arHash and arBucket are allocated together
16:17
they don't have to be though...
don't have to be, no
Ok, I got ya. I get how it's working now
If I find time I'll write a blog post on the topic. I think it's quite neat
(however "If I find time" likely evaluates to false :D)
hello all
how's monday treating everyone?
@NikiC :-(
16:21
@NikiC it's not bad. I'd love to write a benchmark that stresses the hash table implementation to see how it holds up under stress (gut says it should do quite well, but numbers only lie if you don't understand them) :-)
I have a question after reading the rules I'm just gonna jump in
0
Q: nested foreach and equal value function doesn't get current value?

vimes1984Ok i have the following: foreach ($prodarraybiotrack as $key => $value) { if (multi_in_array($value['strain'], $getProducts['products'], 'title')) { foreach ($getProducts['products'] as $keysub => $valuesub) { $dataupdate = array( 'regular_price' => '550', '...

@DaveRandom I'm trying find all files that use a fluent interface, so $this->foo()->bar()
so far I have: #)([^;]+?)\-\>#s
can i return true and a variable from a function?
o.O
@vimes1984 For what purpose?
16:25
129
A: Regex (grep) for multi-line search needed

albfanWithout the need to install the grep variant pcregrep, you can do multiline search with grep. $ grep -Pzo "(?s)^(\s*)\N*main.*?{.*?^\1}" *.c Explanation: -P activate perl-regexp for grep (a powerful extension of regular extensions) -z suppress newline at the end of line, subtituting it for n...

A variable with something in it is true.
@ircmaxell is the Xyproblem towards me?
@fabien thank you
@ircmaxell Hard to benchmark "just the ht" at this point though ^^
@vimes1984 give it a read...
@NikiC well, we could with my unit test suite ;-)
@ircmaxell ^^
16:27
@DaveRandom hmm O_O
aint nobody got time to write benchmarks in c ^^
mock out the memory manager, and the executor, and just access the HT directly from C++
@ircmaxell I did hence the question
we don't need the executor to use the ht?
@DaveRandom does grep -Pzo work for you in OSX?
16:29
@bwoebi why would we?
@ircmaxell ok then as a step back to X all i want to do is find a match between arrayA and arrayB and if they match grab all the values from arrayA and assign them to arrayB
@NikiC Anthony just said: "mock out […] the executor" … I just wondered
@vimes1984 check out array_dif
@bwoebi mock out the Memory manager, and bypass the executor. that's what I meant
oh okay
@ircmaxell thank you :D
16:32
@hohner Wouldn't know, I don't have any Macs handy. Or at all. :-P
Works under centos though, just tried it
@bwoebi no idea
@hohner -P option doesn't exist in os x grep man page.
yay for consistency
16:46
@ircmaxell a thousand thank you's array_diff isn't quite what i used but taking a step back worked!
:-)
The XY problem is often a really good way of looking at what you're doing, once you get over the attachment to the problem you think you're facing
yes it is I suppose it's a the technical version of take a walk!
foreach ($prodarraybiotrack as $key => $value) {

  if (multi_in_array($value['strain'], $getProducts['products'], 'title')) {
    foreach ($getProducts['products'] as $h) {
        if (array_key_exists('title', $h) && $h['title']==$value['strain']) {
          $dataupdate = array(
            'regular_price' => '550',
            'sku' => $value['id'],
            );
          $WCproducts->save_product_meta( $h['id'], $dataupdate );
        }
    }
  }else{
    $data = array(
      'title' => $value['strain'],
is what i end up with...
which looking at it I'm unsuure why it works but it seem's to....
user1607528
there is something about open source softwares' websites' ui designs, its just hard to find what you want
actually I'm a little worries i don't know why it works..
17:31
Warning: ord() expects at least 1073741824 parameters, 1 given in Command line code on line 1
I think I made something wrong, lol
@bwoebi Na, that's just an E_PHP
@Charles no, I'm just working on php-src…^^
@bwoebi Ah, so E_PEBKAC then.
yep
@bwoebi just a little bit :-P
17:35
@ircmaxell confused min and max args oO
nice :-)
yeah, it happens. And is fun when it does :-P
and filled max args with a dummy value which is high enough
INT_MAX isn't "high enough"?
it's actually 1<<30
No, I mean using that directly instead of another sentinal value
eg: why 1<<30 instead of INT_MAX?
(or LONG_MAX, or whatever type you're using)
it was shorter to write^^ … no… actually I didn't know that we have such a define in php
@bwoebi it's a C definition... (in limits.h)
and PHP makes portable versions of them
@ircmaxell he, usually when I write C I just need a very restricted subset of it^^
@SecondRikudo heh
note: I'm not trying to say it's a big deal, it isn't, just curious
@bwoebi it's defined in C89 IIRC
we use it all over the place
17:43
That makes not a difference (afk now)
ok, no problem, just curious
@ircmaxell Don't tell me, part 3?
17:48
lol, or not
Stupid newbie, I bet he top-posts.
Apologies for repeating but:
3 hours ago, by Danack
If anyone who understands how passing variables by reference in a PHP extension is meant to work, and has time to review this function I would appreciate it. I'm not sure if I'm handling them correctly.

« first day (1311 days earlier)      last day (3862 days later) »