« first day (1464 days earlier)      last day (3489 days later) » 

12:03 AM
>Minimum 2-4 years’ experience
How can you have a variable minimum?
 
Hey
Anybody want to help me understand something?
 
12:36 AM
no this room aint too helpful, sorry
 
@Anfurny maybe, what do you have trouble with?
 
I'm trying to understand using php in the linux environment a little better
 
@redshift press Ctrl+K when dumping code
 
It's as much a linux question as a php question really.
 
@Anfurny it's behaving pretty much the same, any specific thing you're having trouble with?
 
12:39 AM
@CSᵠ ok thanks, that was what i was trying to figure out...how to format the code. i even read the help section in this chat room and it just said to do code but that didn't help
 
It's more a general set of questions
I find myself in situations where I unknowingly have multiple php installs sometimes and wonder if there's a clean way to enumerate all PHP installs
And the appropriate way to remove a PHP install when I don't know which package manager installed it.
 
stick with the latest
 
newbie alert: when setting variables to use in the mail() function, is it OK to do this: '$to = "joe@acme.com"; $headers = 'From: <webmaster@example.com>' . "\r\n"; $message = "text here"; $headers .= "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";'  or do the headers have to be concatenated all together like so:
$headers = 'From: <webmaster@example.com>' . "\r\n"; $headers .= "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
 
@redshift use an array for headers and then implode() it
or just use a PHPmailer
 
I don't think that really answers my question.
 
12:46 AM
can someone tell me why my mail function is false? pastebin.com/fawpj3zr
 
the doc is pretty good, honestly
 
@Anfurny try posting it on www.serverfault.com or www.superuser.com
 
thanks
 
do i need to add \r\n to headers in mail function or just \n ?
this is for a linux server
 
1:02 AM
add the constant PHP_EOL to be safe @redshift
 
1:22 AM
@CSᵠ is there a diference in writing php includes as
<?php include('url') ?> vs <?php virtual ('url') ?> ?
i bring this up because i was having some issues with using php includes in my code and i could not get the include to use absolute URLs, i had to resort to relative URLs
but someone recommended I use php virtual...which i tried but it did not work either
and i have never heard of php virtual...i thought that was for shtml stuff
 
how do i know if php is installed as a apache module on my server?
can i find out by viewing phpinfo?
 
2:17 AM
@redshift Sure, look for "Server API"
You really shouldn't be doing remote includes like that, though. That's a sign something has gone pretty wrong in your work flow.
 
 
2 hours later…
4:33 AM
@CSᵠ it should be \r\n always, it's a network protocol after all, ietf.org/rfc/rfc2821.txt ctrl+f: 2.3.7
 
hmmm... A binary tree implementation in PHP gist.github.com/srgoogleguy/94f7cd801bb21cb405d1 not sure if this is actually useful yet :/
 
hi i m trying to install eclipse for php i have downloaded 32 bit eclipse on 64bit OS i already have eclipse installed in my ssytem for android its working fine but
 
@TumblrGuy why does a tree class have a $list?
 
on clicking of eclipse for php it gives me error failed to load JNI SHARED library c:program files/java/jdk/bin.../jre/bin/server/jvm.dll
 
4:48 AM
@cHao To store the in-order traversal for the iterator
 
...
 
anyone can pls help me ?
 
let an iterator store that.
 
Otherwise you'd have to give each node a visited flag or something
 
you'd better be glad PHP is single threaded :P
 
4:49 AM
What do you mean let the iterator store that? The iterator is an interface.
 
is it a tree, or an iterator?
 
It's a tree with a traversable interface.
 
no, it's a tree with an iterator interface. difference being, now it has to keep track of its own state.
which means one tree <-> one iterator.
 
Same thing. That's how you implement traversable in PHP.
I have no idea what one tree <-> one iterator means.
 
heh. i implement it by implementing IteratorAggregate and having one function that returns an iterator.
 
4:53 AM
shrug same thing
 
@TumblrGuy it means that you can't have two iterators going over the same tree.
 
Still have no idea what that means since an iterator is an interface.
 
...
 
can somone pls help me
?
 
it means that you basically can't do anything recursive.
 
4:55 AM
can i install two eclipse for php and for android
 
cause the next level of recursion will reset all the iteration stuff.
 
@cHao no it won't
You probably want to take a closer look at that implementation before you jump to that conclusion.
 
if a tree is an iterator, then it most certainly will.
that's what foreach does to iterators.
 
The object implements the traversable interface. It isn't an iterator. Once again I believe you're making some pretty unfounded assumptions about what foreach does. You probably want to try and prove your theory by testing the code before you jump to any conclusions.
 
the code says class BinaryTree implements Iterator. so yes, it is an iterator.
except it isn't, because trees being iterators doesn't make any freaking sense.
 
5:00 AM
Sure, because it's a subtype, but that changes nothing about your ability to use recursion here.
 
and actually using it as one would break.
hold on..lemme whip up an example.
 
The implementation is for mere convenience in PHP. All that means is that foreach will cause the tree to be traversed in-order and the nodes stored in an array that's returned by the iterator.
 
yeah. and each time the tree appears in a foreach, that array will get replaced.
meaning, whole new internal iterator.
 
Of course, that's the point.
 
...
you're really not seeing the problem with that?
 
5:04 AM
foreach makes it possible to traverse the tree in-order and get the in-order list of nodes back from the iterator. That's the point of making it traversable.
No, but feel free to point out an actual verifiable problem.
So far, "it's a problem" doesn't present me with a problem.
 
ok, say you foreach over the tree, and for each node, you want to foreach over the tree to find some other node related to it somehow.
 
You can't foreach over a node
 
...huh?
 
The node doesn't implement traversable
 
i never said foreach over a node.
 
5:06 AM
What is returned from the iterator is a node, not a tree.
 
yeah. and for each node, i want to foreach over the tree.
 
You can't traverse it with foreach, but even if you wanted to that still presents absolutely no problem whatsoever, since it only return another array of the subtree.
Ahh, I see what you're saying now.
Yea, that's still not a problem.
 
yeah, it is.
 
Go ahead and try it ;)
Trust me, it isn't, because foreach copies
 
working on it. :)
 
5:07 AM
This is a PHP implementation detail, but enjoy
 
it doesn't copy objects.
 
It doesn't need to
 
it copies arrays.
 
Yes, what the iterator uses is an array
 
yeah, but the iterator hides that. so it won't get copied.
 
5:09 AM
Let me know when you're done trying to break it so I can explain to you why you're wrong :)
 
@TumblrGuy can someone pls help me in php i m going to start this
actually i m making simple page using php that will recieve UUID from mobile using web services and will store all data in db
 
@cHao So foreach($btree ..) foreach($btree ..) // this is what you're talking about, right?
The fact that it has modified BinaryTree::$list ?
Because, yea I can see how that breaks the outer foreach.
 
s/modified/replaced
yeah.
that's what i'm talking about
and you'll have a hard time unbreaking that without separating the iterator from the tree.
 
Yea, the real implementation should be to use a stack or a ->visited flag
I was getting lazzy
 
you could easily just implement IteratorAggregate and have getIterator return an iterator over that array you generated
 
5:18 AM
or that
 
wouldn't just be cleaner...it'd be simpler. :)
 
@Ocramius
?
 
@user3233280 this says very little about what you're actually doing.
or how you think we could help.
 
actually i m trying to track device from server for this i m searching on it how can i track device by only taking UUID can i track device from
server
or may i need to register mobile from its map key as well
 
hmm.. now the question is to create SPLBinaryTree or not to create SPLBinaryTree :)
 
5:24 AM
@cHao
 
I have a feeling nobody's going to like me adding this to PHP :/
Probably best to leave it in PECL
 
man this is the problem of spl
so much things would be nice to add, but a lot of them would be needed in a very limited range of cases
so you end up thinking about creating something like php/common pecl lib, but then... there's spl for it
 
heh, yeah
The problem with binary tree search is I can't figure out if the performance is actually worth it yet.
needs more testing
 
@TumblrGuy You could create a generator for the in-order traversal :D
 
I thought about that, but they're harder to do with post-order and pre-order.
 
5:37 AM
Not sure, I've never tried it :)
I see you have moved from Google to Tumblr? heh
 
Yea, I work for Tumblr now.
Although I can't say I'm too happy with how much money I'm losing on my Yahoo stocks at the moment.
 
=(
 
is it illegal to track device using IMEI number from server ?
@TumblrGuy can u pls guide me
 
Why IMEI? Who not a random identifier?
Awesome identation
 
@user3233280 sorry, I can't give legal advice. I'm not an attorney.
 
5:47 AM
random number is safe enough and 100% secure ??
 
What exactly do you mean by safe and secure?
 
means will it always generate uuid for every mobile device but if user has changed his sim in another mobile then how will we track his device ?
 
It's a tracking token ...
Why do you need to track a SIM change?
 
every time tracking token will be different
i just need to track android device from server so uuid will be saved at the time of registration may i need to generate uuid every time whenever i m trying to track device ?
@Ja͢ck
 
Why is the SIM card even important? Seems like a needless detail.
 
5:51 AM
ok fine
pls read the last question
can i do tracking from php or by JS ?
 
If you don't have uuid stored, let the server generate a uuid and store it.
Afterwards, for each request from your app you add the token.
 
server will generate uuid or will i take uuid from my mobile device at the time of registration
 
to prevent a potential uuid clash, I would personally let the server generate it.
 
will my uuid be change everytime whenever i will be trying to send updated location information to server
 
You can store the uuid on the phone.
Once stored, you can use as often as you want.
 
5:54 AM
server will generate uuid for which ?? means how will i know that this is the uuid for device 1 and this is the uuid for device 2
 
The device that asks for a uuid is the device for which you generate a uuid .. I don't see what your problem is.
 
cant i get the uuid from mobile device at the time of rgistration and store it in my server db ?
what will be better options to get uuid from mobile device or generate uuid from server ?
@Ja͢ck
 
4 mins ago, by Ja͢ck
to prevent a potential uuid clash, I would personally let the server generate it.
 
right
 
5:58 AM
fine
thanks a lot u helped me a lot
any good tutorial for making web service in php
?
@Ja͢ck
 
Not sure, I've never read such tutorials :)
 
@nikita2206 here already
 
@user3233280 a web service is very much like any other PHP script -- the only major difference is you're typically responding with JSON or XML rather than HTML.
 
6:17 AM
Content-Type: text/plain :D:D
 
@DanielRibeiro morning
 
@niki
@nikita2206 o/
 
moin
 
6:38 AM
mronig
 
6:54 AM
hashssha why we use this ? what does it return ?
 
user704565
7:07 AM
hi, could anybody tell me why setcookie aint work - headers already sent- and its even at the first line of code
 
user704565
and there are no white spaces/output before setcookie
 
@jakubinf there's something before the setcookie. if there isn't, your PHP is broken.
it might be a BOM, though
 
anyone can help me how to make post request service i m beginner in php
 
@user3233280 no. ask a more specific question, you might get an answer. but we're not here to teach you php.
 
yes i m also googling it leave it
 
user704565
7:49 AM
@cHao so even BOM matters in this? Hw do I get rid of that? I thought that BOM comes in HTTP content, not header.
 
user704565
Thank you very much, @cHao :)
 
You have BOM in php file. PHP parser reads your file and starts to output everything that goes before php open tag (<?php) and BOM happens to be there. And yeah, it goes to HTTP content, that's why you can't send any headers at that point, cause it's too late
@jakubinf ^
 
user704565
Yep, fixed it. What is BOM good for anyway? If I use UTF-8 without BOM and do Content-type: text/html; charset=utf-8... effect is same
 
First encoding of your php file is not necessarily the same encoding that you output in, you can have a UTF php file but send some iso 8859-1 text. And you should be fine without it
 
8:50 AM
Suppose I have static footer (or any other static HTML) what is better way to include it?
`include( 'footer.html' )` or `include( 'footer.php' )` ?
 
@DilipRajBaral what do you prefer?
 
@HamZa I have been using .php for now as a convention to dynamic HTML.
 
@DilipRajBaral great!
 
But from performance point of view, .html must be used for static HTML.
I guess. Read a stackoverflow post just now.
 
have you benchmarked it?
I'm sure that it doesn't matter. Heck, even if you used .txt in an include and echo'ed it, wouln't matter
 
8:59 AM
Yeah. I know we can use other plain file types as well. BUt a stackoverflow post read "Unless you have some dynamic HTML, including HTML inside PHP code block consumes unnecesssary processing and resources."
 
that's if you have *one* html without includes. For example you have a static welcome page
index.html
The OP is suggesting that if you used index.php you will have *little* more processing/resources going on.
I say: the processing is so minimal that it can be ignored.
 
I thought so. Thanks :)
@HamZa YOu know of any HTML 4 browser emulator when we can test our website?
 
@DilipRajBaral any browser?
 
I mean emulator for any modern browsers like Chrome or Firefox.
 
there are some online services but I can't remember...
 
9:13 AM
mornings
 
morning!
 
moin
 
posted on October 19, 2014 by Joe Watkins

Fig 1. A fig, right ?Recently there has been much discussion relating to FIG. Sparked by an open letter to FIG written by Anthony (@ircmaxell). The letter communicates a concern that he and others in the community have; recently FIG seem to be coming up with wantonly complicated solutions to what can be simple problems. These communications are for everybody,  they are open, they use, a

3
 
Open letters are open: Building complexity http://blog.krakjoe.ninja/2014/10/building-complexity.html #php
 
9:54 AM
morning
You're blogging so much Joe, which is awesome. But don't get burnt out.
 
10:28 AM
@NikiC Can a zend_reference point to another zend_reference, or is it always only one single level of indirection?
 
I'm having an issue trying to get the mail() working on a server with php installed as a apache module. Basically, can't receive mail. DOes it matter if php is installed as an apache module or could this be the culprit?
 
@bwoebi only one level
 
fine, thanks.
 
10:43 AM
Hey @JoeWatkins, great bloggin'
 
anyone use phpmailer?
 
@redshift could you put a minimal example of your code in a pastebin/pastie
 
@RonniSkansing code works fine here at home, but running it at work it does not work. This leads me to believe it's a server issue.
do you think sending via smtp may be a better solution?
if i use phpmailer, what do i put for the username and password here?
$mail->SMTPAuth = true;
$mail->Username = 'smtpusername';
$mail->Password = 'smtppassword';
is that something set in phpini file? sorry extreme newbie here
 
11:11 AM
FTR PHPMailer is a little old and crappy now. I'd recommend Swift Mailer
 
will i need server config access in order to use this php mail class libraries
 
12:12 PM
Potentionally.
 
12:49 PM
Morning
 
1:10 PM
Hi all
can someone please help me in he issue I'm having with apache after I upgrade from PHP 5.3.10 to PHP 5.5.18?
 
What is the issue?
 
please check this link:
http://askubuntu.com/questions/538901/how-to-resolve-this-error-i-got-after-php-version-upgrade-the-apache2-configtes
@RonniSkansing:Have you got my issue now?
 
1:29 PM
@PHPLover you probably looked at the contents of the wrong file
go to apache2.conf, not httpd.conf
 
@nikita2206:Following are the content of file "/etc/apache2/apache2.conf"

#
# Based upon the NCSA server configuration files originally by Rob McCool.
#
# This is the main Apache server configuration file. It contains the
# configuration directives that give the server its instructions.
# See http://httpd.apache.org/docs/2.2/ for detailed information about
# the directives.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
 
ok then, show httpd.conf
but use pastebin or gist or something please
probably this file doesn't exist
 
actually the httpd.conf file is not present at location "/etc/apache2"
 
try to comment this line which includes httpd.conf
 
which line from which file?
can you please paste here?
 
1:39 PM
when you try to start apache you get the error in file apache2.conf in line 214? comment this line
 
ok
commented
now what should I do?
 
restart apache
 
I typed in apache2ctl restart
then I got following output:
apache2: Syntax error on line 234 of /etc/apache2/apache2.conf: Could not open configuration file /etc/apache2/conf.d/: No such file or directory
Action 'restart' failed.
The Apache error log may have more information.
 
this is the same problem
just on different line
 
ok
This time it gave following error:
AH00526: Syntax error on line 55 of /etc/apache2/apache2.conf:
Invalid command 'LockFile', perhaps misspelled or defined by a module not included in the server configuration
Action 'restart' failed.
The Apache error log may have more information.
should I also comment this line?
 
1:49 PM
just google it
 
I googled it alot but still couldn't get the solution that's whay I'm asking for help here.
 
apache was upgraded to 2.4 version, some directives changed
google "apache LockFile"
 
ok
 
second link
 
I think instead of commenting the lines I've to make some configuration setting changes. what say?
 
2:08 PM
@DaveRandom halp
 
@PeeHaa At your service, m'lady
@nikita2206 fyi you appear to be talking to yourself ;-)
 
@DaveRandom I burninated a branch on github, but I forgot there was a PR for it :P Now the PR is closed because well I fucked up.
 
You have deleted your local copy, presumably?
 
Can I recreate the branch (doubt it) or do I have to ask another PR for another barnch?
@DaveRandom And on remote :|
CLEANUP FTW!
The barnch is still there on the remote of the PRer
 
Oh right well you can do that, but actually you could just merge the PR manually
You can still retain the commits, the only issue will be that the PR won't appear as merged (I don't think, not sure how clever github is in this regard)
 
2:12 PM
The thing is on github it tells me:
ah I see
Basically github tells me
> PeeHaa closed this 8 minutes ago
And when I try to repoen it tells me: you fucked up :P
 
Although... why is someone making PRs against not-version-or-master branch anyway?
 
Because "my fault" ;-)
@amenadiel I fucked up :-D
Luckily he is also on SO :P
 
Just comment on the PR, as long as it gets merged, surely it doesn't matter? I mean th only thing it affects is the PR page...
 
ah k
 
Just add a remote of his clone to your local, merge in his v1.0.0dev branch into your master, push to your origin remote, job's a goodun
Shouldn't even be any dicking around with rebase if it's a clean merge
Highly recommend you delete that remote afterwards though, I have had a couple of issues with my local co insisting that the rdlowrey remote is the place it should push to
 
2:18 PM
@PeeHaa You could also add their remote to your local repository and do the PR manually from there?
 
luckily github is more intelligent than that, but still
 
aka what dave said.
 
@Danack Yeah doing it now
 
a bit sweary
 
@Danack lol so useful!
Only 7 conflicts :P
excellent super git sauce
\o/
 
2:24 PM
heh
needz moar feature branch /cc @amenadiel
 
What was hindsight again?
:P
Kinda totally only me to blame tbh :P
 
Yeh if he doesn't use a feature branch it only really affects him, but it still sucks if you don't do it and then suddenly realise you want something else based off the same branch in a different PR
 
Lesson learned (yeah right :P)
 
I'm starting to think you should be forced to learn git workflows before you are allowed to use git with anyone else :-P
 
How to file_get_contents from multiple pages from same server in reasanoble time/server load?
 
2:29 PM
although that said, it's one area where it's hard to learn without fucking up a few times
 
@DaveRandom :D
 
The best solution ATM is using AJAX that calls my php responsible or download of 1 page.
 
@Ultra use github.com/amphp/artax instead
 
Sledgehammer All The Things Nuts!
 
POWERTOOLS FTW!
 
2:31 PM
@PaaHaa
 
lol ^
 
@PeeHaa why sould I do it?
 
Because that's a better tool for the job. But tbh I would question whether your architecture is generally correct if you are retrieving multiple pages in a PHP script called from a web request, but I also don't have time to explore that particular element right now
 
@Ultra because it provides an easy interface to grab multiple pages
In a sane way
 
Great guys, thanks for that. Got any resource showing looping over page.com/?productId=X where X will be looped over? ]:>
 
2:34 PM
Defined "looped over"?
 
Get content from page.com/?productId=1 & page.com/?productId=2 page.com/?productId=3 ... page.com/?productId=X
 
@PeeHaa sweet!
KTHNXBYE
 
later
 
Soooo... am I crazy, or does REQUEST_URI usually not include the query string?
(although I suppose it should)
It's so long since I dealt with any of this crap
Turns out I don't really like web dev
Or user interaction in general, come to that
 
2:40 PM
REQUEST_URI only contains the path IIRC
 
I thought so, and yet the current setup puts the query string in there as well
 
@DaveRandom You can always go back to your miserable sysadmin + vb job :D
 
Hmm
Buggy SAPI?
 
Not complaining about my job, just web dev in general
 
Damnit after pushing. The history is gone :|
 
2:47 PM
@AndreaFaulds nginx + fpm
 
Will just ask for a new PR :P
 
(5.6.2)
@PeeHaa You did it wrong
 
@DaveRandom Maybe nginx is passing a bad REQUEST_URI?
 
Probably
 
server {
    listen      80;
    server_name 10.10.8.215;

    root /usr/share/hosts/10.10.8.215/app/public;
    access_log /usr/share/hosts/10.10.8.215/logs/access.log main;

    location ~ ^(?!/static) {
        fastcgi_pass  unix:/var/run/php-fpm/10.10.8.215.sock;
        fastcgi_param SCRIPT_FILENAME /app/public/index.php;
        include       fastcgi_params;
    }
}
^ entire config for this vhost
Nothing weird in there, right?
 
2:50 PM
Look inside fastcgi_params
It might be doing something weird
 
oh true
 
Even though I believe it's a stock nginx include file
 
@ircmaxell may I use that shot as wallpaper?
 
fastcgi_param REQUEST_URI $request_uri;
 
2:51 PM
@ircmaxell ya
 
Among other things, but that's the only pertinent thing
 
Go for it :-)
 
OK, check what $request_uri is in the nginx manual
 
thanks =)
 
I'd have though nginx would break if there was anything weird going on
 
2:52 PM
@DaveRandom fastcgi_param QUERY_STRING $uri
 
I mean tbh I don't really care, it's easy enough for me to strip it, just seemed a bit weird
It's not actually breaking anything
$_GET still works as expected
 
"$request_uri - full original request URI (with arguments)" ...weird.
 
Also, ftr, QUERY_STRING is defined as $query_string
Well it does make sense
I mean the query is part of the URI
 
@Danack Curiouser and curiouser!
lemme see what it is on my server
Oh, it's also $request_uri.
 
2:55 PM
group hallucination?
 
hmmmm
@DaveRandom The CLI server includes the query params in REQUEST_URI
array(22) {
  ["DOCUMENT_ROOT"]=>
  string(10) "/Users/ajf"
  ["REMOTE_ADDR"]=>
  string(3) "::1"
  ["REMOTE_PORT"]=>
  string(5) "51369"
  ["SERVER_SOFTWARE"]=>
  string(29) "PHP 5.5.15 Development Server"
  ["SERVER_PROTOCOL"]=>
  string(8) "HTTP/1.1"
  ["SERVER_NAME"]=>
  string(9) "localhost"
  ["SERVER_PORT"]=>
  string(4) "8000"
  ["REQUEST_URI"]=>
  string(7) "/?=test"
  ["REQUEST_METHOD"]=>
  string(3) "GET"
  ["SCRIPT_NAME"]=>
  string(10) "/index.php"
  ["SCRIPT_FILENAME"]=>
  string(20) "/Users/ajf/index.php"
 

« first day (1464 days earlier)      last day (3489 days later) »