« first day (1385 days earlier)      last day (3553 days later) » 

^ also, review other answers if they're not deleted yet (:
 
Looks like Hamas has a captive now. Shitstorm ahoy.
 
@AlmaDo How can you delete specific answers? I've never seen that before
 
> YAML is the most human-readable data serialization format available to man. And therefore, the best
 
@Jimbo ? it's normal 20k feature. If answer has -1 score you may vote for deletion
 
11:04 AM
WAT?
 
@Jimbo Answers with -1 can be deleted by 20k+ users
 
By 10k+ too. I think
 
@SecondRikudo /trololol
 
that question is first time I spend 3 downvotes on answers..
@SecondRikudo 10k may vote for deletion for answers, which have deletion votes already, if I'm not mistaking
 
@AlmaDo What? No it doesn't work that way.
@Jimbo simple experiment
 
11:05 AM
@SecondRikudo well, I mean -1 answers
 
I've just downvoted the answer on your troll question
Do you see a delete vote link?
 
@Fabien my guess is that Chrome doesn't have an internal mechanism for handing off a request from the textual/gui object rendering process to the video rendering process. When you request an object directly it spins up the gui renderer (which expects HTML or plain text) while it makes the request in order to maximise the apparent speed of the page load.
 
don't upvote him, it's an experiment, I'll remove the vote soon :P
 
@SecondRikudo which ?
 
@Jimbo
0
A: How can I send YAML over AJAX?

QuentinJust set an appropriate content type and send it. // xhr is an instance of XMLHttpRequest which has been open()ed and had event handlers set on it already xhr.setRequestHeader("Content-Type", "text/x-yaml"); xhr.send(string_of_yaml_formatted_data); Note, that most server side languages won't p...

 
11:06 AM
@SecondRikudo 10k can delv questions .. but 20k can delv answers with score of -1.
 
Then it finds that the content type of the response data is something that renderer doesn't understand, so instead of doing a bunch of complicated backtracking an IPC is just aborts the request, fires up the correct renderer and attaches the new request
 
@Jack I'm not sure that's true.
 
That's pure speculation but I can see how it would make sense to do so
 
@DaveRandom Fair enough. Either way a 200 OK instead of 206 is the initial issue which I assume is resolved now. Once the site is fixed hopefully a video will show :P
Cheers
 
11:08 AM
@SecondRikudo Yep, it wasn't a serious question
Got plenty of + for it though :-)
 
@Jimbo I downvoted the answer to see if you can delete it
nvm
afk food
 
@SecondRikudo OHHHH
My bad
 
oops
 
lol
 
Yaml is superior in every way to json and xml #php
I'm going to get a "TEAM YAML" t-shirt
 
11:11 AM
Definitely!
YAML fixed my wobbly table.
 
meh
it looks like crap, it's not natively supported in JS and it needs a PECL extension on PHP
 
if anything should be natively supported in JS, it would be PCRE.
 
Hei!
Noko nytt?
 
@MaciejA.Czyzewski English only in this room please :-)
 
Hey, we have an optician shop called "Czyzewski" :)
 
11:22 AM
@bwoebi That's not funny. :(
 
@salathe It's getting less and less funny by the day...
 
what's the problem of moving phpdoc to git? is it the current deployment system?
 
Something about how SVN revision numbers are more useful than git hashes for translators is the last thing I remember about the subject
 
ah yes
 
Which is blatantly a trivial thing to work around
 
11:25 AM
@Jack most recent discussion php.markmail.org/thread/5uovnasmbs25n67z
 
what's this "cross commit" thing?
hannes mentioned it in a reply.
 
@Jack With SVN modules you can commit something into base and en in one action, in git, even with submodules, it's two distinct actions
(I think is what he's getting at)
 
oh i see
submodules in git are a bit funny.
 
I think it's because SVN basically treats the entire server as one giant repo (as git would see it) and things like submodules are basically just directory level symlinks, not commit level pointers (if that makes sense)
So a single commit can span multiple "repos" because they're all kind of one repo
sort of
 
surely we can write scripts that filter out language files that are outdated in terms of their English counterpart.
 
11:31 AM
Hi Jack
 
'llo
 
Recently you gave the answer of the question
http://stackoverflow.com/a/25079180/1584275
I want to know some thing about it
 
@Jack shop called "Czyzewski"? Hahaha ;-)
 
yep :)
@HarshalMahajan i have to get going, but write your question and I'll get back to you when I reach home.
 
I hope, good xD
 
11:33 AM
1. self is a reserved keyword than how we can create object of it ?
2. Your solution gives error "
Notice: Undefined variable: this in /opt/lampp/htdocs/info.php on"
Sue thanks :)
 
I don't get the point of community questions and answers if a question that is targeted at having an answer contributed from the community will be closed as too generic for one guy to answer
 
@rdlowrey can we suppress the E_DEPRECATED for CN_match in 5.6 when the value exactly matches sslsock->url_name? Since you have to specify CN_match in order for the name to be validated in <=5.5, you can't write secure, cross-version error-free code without a version check, which is kind of wanky
 
> Var 1,2,3 contains testvalues (1, 2,3) should the not be empty?
Do you even English? ^
 
We can remove that check in 5.7/6.0 and just always emit it, but there could do with being some kind of transitional phase
 
11:40 AM
@salathe I was being pretty serious.
@HarshalMahajan btw. self isn't a reserved keyword. Only static is.
btw. @salathe I think for the modules branches are fine.
 
can anyone with < 10k rep check this stackoverflow.com/questions/25078303/… ? What does it show?
 
@bwoebi Fatal error: Cannot use 'self' as class name as it is reserved in ...
Or do you mean it's not a keyword at the parser level?
 
@AlmaDo there is no "id" related to that hash i get the top of the page
 
ok, I see.
 
And btw i'd appreciate the 583 upvotes i need to get to 10k.
 
11:47 AM
@bwoebi sorry what?
 
@DaveRandom the latter, yes.
@DaveRandom I mean a branch for every language.
 
@bwoebi @DaveRandom i found that self is reserved class.
 
@HarshalMahajan yep
 
@JoeWatkins If I needed to install php-xml through multi but the version is already installed. Do i just reinstall or can I switch env then install?
 
if I flag a question, only mods can treat?
 
11:52 AM
If it's a flag with text, yes.
 
I just flagged and picked option 'duplicate'
 
12:04 PM
@bwoebi I'll make an RFC, and only docs people can vote. Muahahaha. >:)
 
@salathe Those with Zend karma all have doc karma too :-P
 
@bwoebi I didn't say people with doc karma... docs people! :P
I'd be very unhappy if we were forced to make an RFC anway.
 
I meant some informal vote about what most docs people want…
not something infernal like the php6/7 vote.
 
We've been having those for yyeearrrsss, informally.
 
ah okay
well, just migrate it and then look what broke^^
 
12:17 PM
@bwoebi I've been very tempted to do exactly that! It's amazing how productivity increases when, "OMG it's all brokened!!!"
 
good bye friends.
 
@salathe this. pure truth.
 
Especially if we start breaking the docs infrastructure just as 5.6 gets released :)
 
hehe
 
is self class return the current class object context ?
as i found in jack's answer
@bwoebi
$o = new self;
$o->name = $n;
 
12:22 PM
that's a new instance of the class.
 
ok thx man
 
I'd prefer to be more explicit. Even if you're in the Payment class, return new Payment; is nicer.
 
@Jimbo huh?
 
@Jimbo y so ?
 
@bwoebi I wouldn't return new self, I'd prefer to actually type the class I'm using. It's just nicer to see really :-)
Like $o = new Payment instead of new self
 
12:25 PM
here is quite interesting, Jack's answer
stackoverflow.com/questions/25078985/return-current-object-through-static-method
 
I'd actually say the exact opposite @Jimbo.
 
@bwoebi How come?
I mean, unless you're using the code with multiple classes or something...
 
@Jimbo self is always the current class and independent of the class' name.
 
@bwoebi Of course, so if you're using it in multiple places to be used my multiple classes somehow, sure. But if it's one spot, I'd prefer to do $o = new Test; - that's just me though. It's probably literally opinion based I guess
Actually, if you extend the class, but inherit the method that returns new self, when called from the extended class does it return a new instance of the extended one instead of the parent?
 
@Jimbo is this approach make differences with using self ?
 
12:28 PM
@Jimbo that you decide by using self or static.
 
@HarshalMahajan No difference. Just opinion :-)
@bwoebi Ah, late static binding right
> YAML has the ability to reference other items within a YAML file using "anchors." Thus it can handle relational information as one might find in a MySQL database.
I did not know this!
 
@Jimbo stahp
 
^ that
 
In the Netherlands is it pronounced JAML?
 
@Jimbo and yaml, sitting in a tree, creating hateful data storage architectures and not even bothering to rhyme
 
12:35 PM
LOL
 
@Fabien No i believe it's pronounced like this
 
lol
If I need to compile PHP with XMLWriter class how can I see what flag I need?
Fatal error: Class 'XMLWriter' not found in
 
Should be enabled by default
 
> It was later added to the PHP source (bundled) as of PHP 5.1.2. This extension is enabled by default.
 
12:39 PM
I can't see it in php -i | grep xmlwriter
 
--enable-xmlwriter then
 
How do I discover this without bothering you folk?
Cheers too btw
 
Oh wait you did disable-all
Why did you do that?
 
It's Joe's defaults not mine.
 
@Fabien don't disable-all unless you are developing PHP
 
12:41 PM
So theoretically I can remove that disbale-all call then dnl the rest of the lines?
And it should do all the php defaults?
or just dnl the disable-all
 
Oh right it's for multi
 
:)
 
In that case yeh disable-all is probably sensible, but beware there is a crapload of stuff you probably want that won't be built if you do that
filter, for example
@Fabien what are you actually doing with multi?
 
Multiple PHP versions for our multiple versions of Drupal
 
@Fabien ...and the older versions of Drupal won't run on newer versions of PHP?
 
12:45 PM
They're not recommended.
Also some already deployed environments. (before my time)
 
I have to say I would rather keep the platforms more isolated than that (separate boxes) for things requiring different PHP versions
Running multiple versions in production is asking for trouble IMO
 
Drupal 6: PHP 5.2.x only. Warning: support for PHP 4.x has been dropped. PHP 5.3 and later may produce errors or unexpected behaviour.
Drupal 7: PHP 5.2.5 or higher (5.3 recommended).
Drupal 8: PHP 5.4 or higher.
@DaveRandom Production doesn't. This is staging.
I have been becoming more familiar with Docker to support multiple environments. Not there yet though.
 
@Fabien Looks like you can run 6 on 5.4 without any real problems: drupal.org/node/1913314
And since 7 recommends 5.3 it should run fine on 5.4+
and 8 is 5.4+ as a requirement
 
We use 6 predominantly.
 
So I would suggest just throwing 5.4.latest on the server and seeing if anything actually breaks
If it does, do something complicated, if it doesn't (or it's easily patchable) then just stick with 5.4 and you don't have a problem
 
12:49 PM
Will do. With that though i still need to compile it properly with xmlwriter :P
 
Well yeh but you can probably use rpms with no issues there
Also if you only have one version then you can build it youself without disable-all
 
For some reason I don't see it in the php -i configure even though I set it in defaults.
 
and actually for what you are talking about disable-all is probably less necessary anyway because it doesn't matter so much if there are differences between versions because they are being used for different things
The point of the disable-all in multi is (afaict) to level the playing field so you don't hit any oddities in behaviour because of different default exts
but since you are not doing cross-platform testing, the playing field doesn't need to be level
 
Fair enough
I need Joe anyway. I added the xmlwriter to php.defaults but I still can't see it after its compiled
enable-xml
enable-xmlreader
enable-xmlwriter
 
@J7mbo Yaml saved my marriage!
 
12:56 PM
nm
 
@Jimbo You Ate My Life?
 
@Ocramius You Are Mighty Meaty Lesbian
 
hmm, why would this raise an exception:
    @libxml_disable_entity_loader($options == (LIBXML_DTDLOAD | LIBXML_DTDATTR));
> Undefined variable: options *** /vendor/phpoffice/phpexcel/Classes/PHPExcel/Settings.php : 384;
 
Sorry Dave. Being a noob.
 
it shouldn't, should it?
 
1:01 PM
@Fabien Try it without disable-all
 
@DaveRandom It was me being a dick. I forgot to change env when checking php -i
 
@Gordon where is $options defined?
The current default branch references a static property instead of that local var
 
@DaveRandom oh, it's an ==
 
Granted xmlwriter wasn't installed. Adding it to php.defaults worked.
 
now it makes sense
 
1:04 PM
May be a typo in an old version?
 
jupp, thanks for spotting it
 
:-)
 
sometimes all you need is a human rubberduck
 
DaveRandom is a champion of fixing other peoples problems.
You should shorten your CV to 'Problem solver'.
 
"Blithering idiot" is more accurate though
 
1:07 PM
@Leri pong
Also: Good morning!
 
@datibbaW @J7mbo yaml killed my father!
 
@Fabien that was my official title 2 jobs ago
 
@ircmaxell lol.
 
@ircmaxell Morning. Are you aware of any good RNG for php? I'll be using one for slot alike games. There for RNG seed is the most important, so that players playing at the same time don't get similar number sequences.
If not what should I read to implement one properly?
 
@ircmaxell Thanks. I've got one (probably, silly question): What is the chance that the end-user reverse-engineers the process i.e. predicts future sequence.?
 
if you use medium strength or higher, then, assuming I didn't make any dumb mistakes (which I do have tests for), virtually impossible
RandomLib was audited for crytographic purposes
 
Great. And you mention that medium and high strength generator consume resources. Well, those games will have multiple simultaneous users, so I guess, I'll be using medium.
So, how slow should it be with medium? imagine generation 3 digits long number?
I'll do own benchmarking, of course. I just want to know if it worth in the first place.
 
hm. What will be (nice) solution to: Given an input $array (like ['x', 'y', 'z']) and input number $number, where $number is between 0 and pow(2, count($array))-1, get result array, which contains only those items, which correspond to $number bit set. I.e. if $number is 5 for $array = ['x', 'y', 'z'] - we need to result in ['x', 'z'] ?
I have in mind solutions like base_convert() + array_intersect_key(), but they look ugly
 
@AlmaDo You mean where at least one of the set bits in $number is also set in the array index?
 
1:32 PM
well, no. 5 = "101" binary. Thus. it corresponds to "x" set, "y" not set and "z" set
 
oic
 
so result is ['x', 'z']
for $number position of bit corresponds to order of elements in $array
 
Yeh I get you
Well you obviously can't do it without visiting every bit in the input mask so it's O(n) at best
 
well, it's about "how to check if certain bit is set for given integer value"
 
moment
 
1:36 PM
oh.. got that
$result = array_filter($array, function($x) use ($z, &$i)
{
   return pow(2, $i++) & $z;
})
well, that has order issue (like 6 is ['y','z'] while should be ['x', 'y'], same for 3) - but it's irrelevant and easy to fix
 
@AlmaDo Why array_filter does not pass the key to the callback I do not know...
What's $z in that code?
 
@DaveRandom my "key" is $i - array always has consecutive numeric keys, so..
@DaveRandom $z is $number, yep - my bad
 
@AlmaDo Yeh but it's still kind of wanky that you have to do it yourself, and makes it a lot less useful for assoc arrays
 
My array is no way associative (and if it will be, I can do same thing with array_keys() of that array)
 
true
 
1:49 PM
side effect: easy way to get all combos:
$array  = ['x', 'y', 'z'];
$result = array_map(function($x) use ($array)
{
   return array_filter($array, function($y) use ($x, &$i)
   {
      return pow(2, $i++) & $x;
   });
}, range(1, pow(2, count($array))-1));
but that's not for what it was needed
 
I so do not understand the value of functional programming in PHP
 
why?
or your point is not that "it's bad"? (i.e. just "no benefit") ?
 
Oh no I don't mean it's bad, you just don't gain anything and you do (IMO) lose something in readability
Nobody ever actually reuses stuff in the manner for which functional programming was intended so it just makes no sense to me
It has it's place, obviously, but PHP is not it
 
well, may be, but alternative is ugly foreach loops with base_convert or something like that (for this issue).
I think if wrap the code into a method with readable name - nobody will care what's inside
plus, you'll win some microseconds (but that's insignificant, of course)
 
	public function testWhile() {
		$from = new While_(
			new Variable('a'),
			[new Variable('b')]
		);
		$to = [
			new Label('compiled_label_0'),
			new If_(
				new BooleanNot(new Variable('a')),
				['stmts' => [new Goto_('compiled_label_1')]]
			),
			new Variable('b'),
			new Goto_('compiled_label_0'),
			new Label('compiled_label_1')
		];
		$this->assertEquals($to, $this->traverser->traverse([$from]));
	}
 
2:03 PM
Sweet mother of all that is underscored.
 
@Jimbo E_KEYWORD_COLLISION.
 
$str = file_get_contents('countries.json');
$a = json_decode($str,true);
echo $a[0]['name']
hello please help this is my php
//and json is :[
  {name: 'Afghanistan', code: 'AF'},
  {name: 'Åland Islands', code: 'AX'},
  {name: 'Albania', code: 'AL'},
  {name: 'Algeria', code: 'DZ'},
  {name: 'American Samoa', code: 'AS'},
  // …
i am having trouble
it is saying use of undefined constant name
 
Damn I'm thirsty!
 
Drinking beer using a straw is eeeew :)
 
@PradeepSaini the error is elsewhere in your code. Check each occurence of name and make sure it's quoted
 
@PradeepSaini this isn't valid json
 
2:25 PM
@FlorianMargaine that as well, but that shouldnt give a "use of undefined constant name", or should it?
 
@florian : sorry for wall of text,but this is my exact json file.
 
It's not valid json
According to JSONLint
 
then what is?
please help i m stuck
 
Your keys need " around them
"name"
"code"
 
okay..someone interviewer sent me this file and asked me to implement autocomplete
with jquery and php
*someone
 
2:30 PM
@Jimbo the keys as well as the values
 
Yep :)
 
it's valid js as is, but not valid json
life shucks, ain't it
 
yes it does @florian
 
but even with the invalid json … it should not cause that error message
invalid json returns null
 
sorry,i was missing '' around name in echo $a[0][name];
thats why the aerror,now its showing null
@gordon

when i am write

<? php

$str = file_get_contents('countries.json');
echo $str

?>


its printing the whole json file as it is
but if i do

$str = file_get_contents('countries.json');
$a = json_decode($str,true);
echo count($a);

its printing 0
 
2:36 PM
Try doing:
 
@DaveRandom unless you're trolling, stop it. If you are, keep going.
 
<?php

ini_set('display_errors', 1);
error_reporting(-1);

$str = file_get_contents('countries.json');
$a = json_decode($str,true);
echo count($a);

?>
@FlorianMargaine I guess I'm feeling charitable...
 
@PradeepSaini Have you tried jquery>?
@Gordon much better :D
 
@PeeHaa How'd you get on with Chibi?
 
@PradeepSaini can you please refrain from adding unneeded whitespace into your code samples? also, write code snippets in a separate message and format them as code by hitting ctrl-k or clicking fixed font. thanks.
 
@PradeepSaini json_encode returning null is expected behavior when your json is invalid.
 
@Fabien Still bookmarked, still nothing done with it :)
 
hi guys...does anyone knows if it is possible to create a mouse hover select row effect with php? or do i have to use another way?
 
@PeeHaa Slacker.
 
Hey @AlmaDo I realise you've done it now but I just had a thought about your bitmask array issue: 3v4l.org/JdYjI
 
2:45 PM
yeap :D
 
@gordon Is this right json format :
 
@Japa PHP does not run in the browser. You need javascript. PHP can only write the javascript into the page you will deliver to the browser, which is then executed on the user's computer. by the time that happens, there will no php left in the sourcecode of the page.
 
[
{'name': 'Afghanistan', 'code': 'AF'},{'name': 'Åland Islands', 'code': 'AX'},
{'name': 'Albania', 'code': 'AL'},


{'name': 'Algeria','code': 'DZ'},
{'name': 'American Samoa', 'code': 'AS'}, {'name': 'Zimbabwe', 'code': 'ZW'}
]
 
@PradeepSaini see for yourself: jsonlint.com
 
@PradeepSaini no
 
2:47 PM
Redspottedhanky is so wank for refunds. You have to A) Submit a refund request on the site. B) Send a letter asking for the refund.
if you only do A and 28 days pass... no refund
 
Just read the damn JSON spec, it's like 4 paragraphs or something
 
Archaic fuckers
 
@Gordon thanks for answering...but how about if instead of mouse hover...i create a check box, this way is possible?
 
I really do not understand how people can misinterpret such a simple thing so often
 
@Japa same thing as above. PHP can write the HTML you will deliver to the client.
 
2:50 PM
@DaveRandom Why the fuck did you even try it in the first place :P
Too Good Guy Dave ™
 
@Gordon ok gordon, thank you for helping me...i´m trying to create a table that fetches info from my database...and then when the user selects a row or checks a check box...the content of the row goes to an input....do you know a good tutorial for this?
 
@Japa Any starters JS / DOM tutorial will show you how to do this
 
2:52 PM
Probably in a very very poor way but they do :P
@Jimbo HAHAHAHHAHAHAHAH EXCELLENT!
 
ok guys, thank you for helping me
regards
 
@Japa on mousehover event of jquery , you just need to append the HTML code on particular position
 
@DaveRandom same there :p conversion to string (so, radix conversion ) :p But thanks
 
Aaaaaaaaaaaaaaaaaand another badge on one of my VB/net shizzle questions! :P
 
@AlmaDo Yeh indeed, I just though it was a little more readable (since you presumably end up with a count() - pow() to make it apply the mask in the right direction)
@PeeHaa That's not VB! You got me all hot under the collar then. I was literally reaching for my gun.
 
2:56 PM
 
@DaveRandom You want actual vb?
 
Depends whether it's the beer kind or not
 
2
Q: VB.net app without installation

PeeHaaIs it possible to create a VB.Net application which users can just run without installing it first. If not, is it possible in another .Net language. If not, how IS it possible :) PS: The application only has to run under Windows (>= XP).

BITCH!
Also wow. I'm scar(r)ed of my SO history. WHat a fucktard that peehaa
 
Why were you writing VB, sorry?
 
I don't know how to look up my SO history: problem solved.
 
2:58 PM
@DaveRandom Only thing other programmer knew when I worked at a previous job :P
 
@PeeHaa I hope you killed them
 
Yeah, sorry... My questions have received too many negative votes and I was banned. — IPBFocus 40 secs ago
 

« first day (1385 days earlier)      last day (3553 days later) »