« first day (503 days earlier)      last day (4428 days later) » 

3:09 PM
Anyone with xpath chops want to save me a bunch of time searching?
nevermind
 
Bob
Hello
 
finally, no errors:

Leighs-MacBook-Pro:php leigh$ php -v
PHP 5.4.0 (cli) (built: Mar 2 2012 15:02:14)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies
 
Bob
Anybody who know a little about public chryptography?
 
user895378
@Leigh I've had a hell of a time whenever I've tried to use PHP on non-linux systems ... I refuse to do it any more because I don't want to complicate my life :)
 
heh
 
3:21 PM
@rdlowrey: I get forced to use a macbook at work
 
its better than other alternatives you could be forced to use ;]
 
user895378
@Leigh Oh no, Mac groupies! But you probably unknowingly started dressing more cool and dropping Indie-chic band names in every day conversation
2
 
Bob
Does anyone know digital signing?
 
@CarrieKendall: Very true, I actually have the option to request whatever I want (some of the sysadmins have alienware laptos running linux...), but I'm reasonably happy with this, it's a good midway between unix and windows.
@rdlowrey: I try not to talk to people, it ruins the illusion that i'm actually working.
And, strangely, the only errors I was getting were actually down to modules needing to be recompiled
 
hi anyone wants to discuss mod_php vs php on fscgi with some one new to fscgi
 
3:30 PM
@Bob what about it?
@lovesh FCGI wins...
 
i have reasonably good experience with php but have been using php as an apache module on a linux. But now i have no experience on fastCGI but want to implement it on my new project
 
it's pretty easy...
 
I was going to say, you're unlikely to have any real problems with it.
 
@ircmaxell but how do i start with it? i use linux but am not a linux hacker type so i dont deeply understand proceeses and forks and that stuff
but i am prepared to do the hard work
 
Bob
@ircmaxell I am trying to understand the overall concept of digital signing so the question is: When you digitally sign something you probably use the private key to encrypt something, what do you encrypt? and how do people with the public key check that it is valid? Like what do they check against?
 
3:33 PM
@lovesh it's not hard to setup, you want to stick to apache? or do you want to switch to a different server like NginX (my suggestion)
@Bob signing has nothing to do with encryption
 
@Bob Think of the signature as kind of a secure hash
@Bob A hash that also verifies the identity of the person who signed it :P
 
@ircmaxell should i make the switch? I have no experience with Nginx. But i wanna get my hands dirty
 
@lovesh: What's stopping you? :)
 
but you can sign with encryption...
@lovesh then do it
 
@Leigh nothing. I just wanna know that is it worth?
?
Is Nginx better than apache
 
Bob
3:36 PM
@ircmaxell That was what I ment, how do you sign by encrypting the content, what do you encrypt?
 
@lovesh: How about, its worth it for the experience. In future you will know, you can setup and manage an nginx install. And yes it's "better"
 
A digital signature or digital signature scheme is a mathematical scheme for demonstrating the authenticity of a digital message or document. A valid digital signature gives a recipient reason to believe that the message was created by a known sender, and that it was not altered in transit. Digital signatures are commonly used for software distribution, financial transactions, and in other cases where it is important to detect forgery or tampering. Explanation Digital signatures are often used to implement electronic signatures, a broader term that refers to any electronic data that carr...
 
@ircmaxell what do u say about Nginx vs Apache?
 
@lovesh Avoid apache at all costs
 
user895378
@lovesh Also, the new PHP 5.4 release makes a couple of things slightly easier for the FastCGI SAPI that were previously only available to apache: us.php.net/manual/en/migration54.sapi.php
 
3:39 PM
@ircmaxell can you please elaborate a bit or point me to some links
 
user895378
Namely: getallheaders(), apache_request_headers() and apache_response_headers()
 
@Bob: For a very basic example, if you encrypt your name with a private key, and the recipient has your public key, when they decrypt it, they will know that it's from you. You can also include checksums to prove the document was not modified
@lovesh: Just google "nginx vs apache"
 
@rdlowrey was it to me?
 
Bob
ah, that made sense
 
@lovesh google for it, it's not that hard to find... There are TONS of resources out there
 
Bob
3:40 PM
But what if hash the encrypted name, what do you do at the other end?
 
@ircmaxell ok
 
user895378
@lovesh Yeah, just a note to mention FastCGI is gaining more momentum every day
 
@rdlowrey well i havent heard of these. But i am a newbie.
 
@Bob: I don't understand what you mean.
 
Bob
Let say you have a document saved as a Word file
it is 40 MB
then you encrypt it
Now, for people to be able to verify it is you who have written it you give them the public key right?
Then you need to give them the content and the encrypted content
wouldn't that make the total very big?
 
3:44 PM
@Bob thats not usually how it works. You typically do not encrypt the file. You will just generate a signature, signatures are small.
 
Bob
What do you generate the signature from?
 
@Bob Ok, certificates have are comprised of a private and public key, and your personal details right
 
user895378
@Bob Doesn't matter, the feds will just break it without your help anyway: wired.com/threatlevel/2012/02/…
 
user895378
:p
 
@Bob So you "encrypt" something that identifies you, and something that proves the document hasn't been modified...
 
Bob
3:47 PM
@Leigh I do not know a lot, sorry. What do you mean by certificates are comprised by private and public key?
 
@Bob when you entered the chat, you asked about "public key cryptography". So I assumed you know in this case keys come in pairs. One public, One private. When you digitally sign something, you typically do it with a certificate, much like a websites certificate that allows you to use https:// and you know that the connection between you and them is secure, because you have validated the certificate
@Bob certificates themselves are digitally signed
@Bob a hash of the certificate is generated, encrypted with the private key, then attached to the cert. You verify the cert is valid by doing a hash of it yourself, and comparing with the original that you decrypted with the public key
 
@ircmaxell pleeeeaassseee don't top post in your replies to the mailing lists. "Place your answer underneath anyone you wish to quote and remove any previous comment that is not relevant to your post." -- php.net/reST/php-src/trunk_README.MAILINGLIST_RULES
 
@ircmaxell i read here that nginx is good when you need fast serving of static content. Does that mean i should serve images and scripts from nginx and php from apache?
 
@lovesh: No, you should use fcgi php and serve it via nginx ;)
 
@lovesh it's good
@salathe ok, sorry
 
3:57 PM
@ircmaxell Thanks, it's a million times easier to follow discussions when replies are made directly under the comment being replied to. :)
 
@ircmaxell sorry i dint get ur answer. "its good"?
 
@rdlowrey: Did you post the wrong link when you were talking about the feds decrypting laptops? I found this one wired.com/threatlevel/2012/02/decryption-flap-mooted/…
 
@salathe Ok, will keep that in mind
 
user895378
@Leigh Aha yes, was angling for that one. I knew I had just read it on wired in the last couple of days and must've seen the similar headline and grabbed it. Thanks :)
 
@rdlowrey: Both equally as relevant, and scarey
 
user895378
4:00 PM
@Leigh But not surprising. US gov't thinks it's the boss of the Internet and all things digital.
 
user895378
Didn't you get that memo? The US gov't owns your password. If you can't remember it ... well, you better damn well start drinking some herbal tea or something to help stimulate those neurons.
 
I think just for fun, I'm going to put an old hard drive in my box, and pipe /dev/urandom to it
let them waste their time decrypting it, if ever I get taken down for something.. like owning a copyright mp3
 
user895378
LOL. Wait, you don't own a copyright mp3. The RIAA owns it and you just get licensed to store it on 5 or so devices. God help you if you let your little sister or grandmother listen to that mp3 file, though. They didn't pay the license fee ...
 
I'm not licensed to store it.. oh shi...
 
Hello guys
 
4:10 PM
is there an SPL exception for missing file ?
 
user895378
@Incognito See the top link over on the right with 9 stars?
 
No, I have a css reset that removes that.
But... mind=blown.
 
@Incognito What about it?
 
@Incognito: You're late to the party
 
4:19 PM
I just thought it was never coming out.
 
user895378
@Incognito Yeah, yesterday I walked away from the computer and an hour later there were like 600 new messages in chat about it here. PHP 5.4 = released
 
@Incognito Ah, you mean 5.4?
Yeah, that was released yesterday. See the stard messages at the right ;)
 
$array = [lolz];
Is it actually stable?
 
@Incognito I'd say so
Though I'd wait til 5.4.1 before using it in production
 
4:23 PM
-1
A: PHP and Cron job

anubhavaBest is to pass a command line parameter to your script from cron and then check for that parameter using: $_SERVER["argv"] OR $argv

 
user895378
I've been using the RCs for a while on my local dev box with no issues ...
 
> 16.3k
wtf?
 
@tereško: Better matching duplciate in comments
 
you have to be a moderator , to change the duplicate .. and i'm not
 
4:24 PM
5000 rep to go.
 
@tereško Yes? Can't you just edit it?
 
@Incognito call the cv-ring guys to collusion you up ;)
 
oh .. damn , i can
 
[Give-me-all-the-powers!!]
 
user895378
lol
 
4:26 PM
Blah. Tags.
 
i am tempted to bomb that guy with downvotes
 
The guy with 1 rep?
 
The edit was probably uncalled for @salathe =/
 
@Incognito I doubt anyone would ever call for it.
 
4:28 PM
@salathe lol!
 
:)
I call for the defacement of whores! Rabble rabble rabble!
 
teehee his name is "a nub hava"
 
lol..."i'm a naughty rep whore"
 
Great, we're oging to have Upvotes Uesdays, like that nonsense on twitter.
-4
A: PHP and Cron job

anubhavaEdit: I'm a naughty rep whore.

This way it shows up in the chat.
 
4:30 PM
lol, bad salathe!
 
I don't see anyone rolling back the edit. :P
 
heh
 
He could do it himself I'm sure?
 
what's this about "moderators"? that an alt?
 
@cHao 10k+ grants mod tools to you. You are a de facto mod.
Or my latin use is bad.
 
4:32 PM
what if you never use them? :()
 
user895378
Note to self: don't cross salathe.
 
lol
 
@rdlowrey You're fine if the following aren't all satisfied a) friday afternoon, b) repwhore, c) REPWHORE!
 
user895378
yeah ... at 16.3k one should really know better ... or at least he should now
 
4:36 PM
He's probably got a lot of rep from the ASP circles or something.
Looks like he knows regex and just answers all the one-offs:
 
1090 answers, highsest upvote of 11...
 
user895378
@salathe Quick question: the new in 5.4 http_response_code() documented here as being an addition to the PHP core is definitely in core and not part of the PECL HTTP extension (whose functions are prepended with http_), right?
 
looks like he just spams and hopes
 
@rdlowrey yep
 
user895378
@salathe cool, thanks
 
It's just a wrapper around sending a status header? Or there's more to it?
Does it defer until all headers are sent, so you can change multiple times during a request?
 
yes to both
 
it's the status sent before the headers (well, as the first line)
but yes it's like any other header, you can change it so long as the headers haven't been sent yet
 
So it allows you to change it, and it's automatically sent on the first header call?
 
@Leigh My answer/rep ratio is something like 50 I think.
 
4:44 PM
what if the first header call sends a status header? :D
 
@Incognito Hopefully you mean rep/answer ;)
 
I did, I just didn't want to edit and re-ping him.
 
I'm here, re-pinging is not a problem :p
 
Hey how does php do rounding when casting a string as an int?
 
My issue with re-pininging is it may get annoying, so I avoid it and let errors go. My logic is if it's going to be annoying don't correct myself.
 
4:47 PM
@Incognito how do you work that out?
 
it seems to always round down.
 
Can you find out your rep from answers, as distinct from other sources?
 
@salathe Rep score, divided by answers. If I were ambitious I'd use the data site and exclude the questions.
 
@Incognito 50 is pretty high. I don't have that much
I have more like 35
:(
 
Questions I like to answer are generally in-depth explanations. I don't enjoy simple ones very much.
 
4:50 PM
@NikiC 26 :(
 
user895378
When I first started SO a couple months ago I just spam answered. Since then I've realized it's (though slower) generally better to answer thoughtfully and only when you're very knowledgeable on a topic. Slowly raising the ratio ... into the 20s now :)
 
user895378
The FAQ should mention something about minding your ratio ...
 
Ok cool, it is smart enough to check what is being sent as the first header :) (not that I was expecting it to fail, just curious)

http_response_code(505);
header("HTTP/1.1 404 Not Found");

Returns 404 as expected
 
user895378
@Leigh Is there any need to return a string code message like "Not Found" unless you're sending a custom response code? I.E. should http_response_code(404) be sufficient (and not header("HTTP/1.1 404 Not Found");) ???
 
Noone?
 
4:54 PM
@rdlowrey: Technically not I suppose, the browser will go by the numerical code regardless of the message. I was just copy/pasting.
 
user895378
@Leigh That's what I thought, but I was just asking, not contradicting :)
 
@Neal: It more than likely stops at the first non-numerical character (i.e. your decimal point), so it will truncate, not round.
 
Data site's driving me nuts. Is there a way to select just answers/posts?
 
@Leigh odd
 
@Neal not really, if you're typecasting a string to an int, expect to lose the precision. There are built in functions for doing proper conversions to floats if thats what you require
Unrelated, already finding the 5.4 built in webserver really handy
 
5:10 PM
just thought i'd share: quora.com/Facebook-1/…
 
@rdlowrey , "mac groupies" would be people who do not own macs themselves , but like to hang near them
 
I own a mac, program in ruby, and wear tick-rimmed glasses with the lenses popped out. I have a tattoo of a snake on my chest. I guess I'm just more sophisticated than everyone, like you.
 
glasses with ticks for rims O.O
 
Hey all
How do I do ON DUPLICATE KEY and update with all of what I wanted to insert?
 
5:27 PM
I guess that depends on what all of what you want to insert is.
 
@Leigh all the data i was going to insert, i want to update if there is a duplicate key
 
@Neal oh well, in that case, just write a query with all of your data in it then. See how my answer was as helpful as your response?
 
0
Q: Is there a way to use ON DUPLICATE KEY to Update all that I wanted to insert?

NealI know that you can use ON DUPLATE KEY to update a certain value if there is a record for that key already, But how do I make it so that it inserts all of which I was going to insert into the row that already exists?

 
@Neal the format is very simple, if you're having difficulty I have to assume you're doing something more complicated. You've given no example, how are we supposed to help?
You want me to post an answer and say "use commas to separate the key value pairs after the word UPDATE" ?
 
@Leigh I updated my OP
 
5:34 PM
@Neal: right, thanks for the clarity. I don't think you can.
 
@Leigh hmmm
odd
 
@Neal: There's no syntax that I know of for "all_fields" = "respective_values", except in trigger rules
and for trigger rules, I think I may not even be thinking about mysql..
 
@Neal You could use REPLACE INTO ;)
 
@NikiC ?
 
@Neal: When you say "every n values" are you doing a bulk insert?
@Neal: With more than one set of values, i.e. VALUES (1, 2 , 3), (1,2,3), (4,5,6)
 
5:39 PM
@Leigh no different amounts of columns
 
@Neal: Then no, there's no syntax for it. If you're building your query dynamically, you can build your update clause dynamically too. If you're writing it statically, then you also need to statically write the update.
With the bulk insert you can actually UPDATE x = VALUES(x)
 
hmmm
 
Right, time to go home, go out, get drunk, buhbye
 
@Leigh bb
 
@Neal REPLACE is very similar to ON DUPLICATE KEY UPDATE, so maybe you can use it. That's what I meant ;)
 
5:45 PM
@NikiC how do u use it?
 
@Neal Replace INSERT INTO with REPLACE INTO ^^
 
@NikiC ?
example?
 
0
A: Is there a way to use ON DUPLICATE KEY to Update all that I wanted to insert?

NikiCYou might consider using REPLACE INTO instead: REPLACE INTO `tableName` (`a`, `b`, `c`) VALUES (1, 2, 3)

 
@NikiC but i dont know what the key im replacing is.
how does that help?
@NikiC I don't want my old row to be deleted
> REPLACE works exactly like INSERT, except that if an old row in the table has the same value as a new row for a PRIMARY KEY or a UNIQUE index, the old row is deleted before the new row is inserted. See Section 12.2.5, “INSERT Syntax”.
Why would I want that?
 
hellow
 
5:51 PM
Hello @PeeHaa
 
@Neal REPLACE = INSERT | UPDATE if row already exists
 
@NikiC No read the Docs. It deletes the old row
I do not want that
 
@Neal Yes, it deleted the old row and inserts a new one. How is that different from updating an old row? (Yes, it is different, but only from a internal point of view)
 
@NikiC Yes, but iwant to keep the old row.
that matters in our system.
we need the ID
 
Ah, okay, I thought that you were doing a full insert
and not a partial one
 
5:56 PM
@NikiC I was. but for other parts of the system they save the ids
 
6:16 PM
Hello ... I am having cmis problems with drupal ... anyone here wants to look into it?
 
 
@Donut Thanks a lot
 
6:30 PM
This doesnt seem to be working...
:-(
    INSERT INTO `riskvalues`
    (`limitsToBrokersid`, `value1`, `value2`, `value3`, `action1`, `action2`, `action3`)
    VALUES
    (?,?,?,?,?,?,?);
    ON DUPLICATE KEY UPDATE
        `value1`=VALUES(`value1`), `value2`=VALUES(`value2`), `value3`=VALUES(`value3`), `action1`=VALUES(`action1`),
        `action2`=VALUES(`action2`), `action3`=VALUES(`action3`);
I get this error:
> "Row insert error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ON DUPLICATE KEY UPDATE value1=VALUES(value1), value2=VAL' at line 5"
why can't I do that?
 
Because you have an errant ; in the middle of it
the ON DUPLICATE KEY UPDATE segment is part of the whole query. It's not two separate queries
 
@LightnessRacesinOrbit hehe i see that now. Testing.
 
be sure to give Teez's solution a go, too. be wary of its subtly different semantics, but it may be simpler to use in that it takes you all the way to what you're after.
feel free to re-assign the accepted answer if that's what you go with
ciao
 
@LightnessRacesinOrbit Now im getting this weird error:
> "Row statement insert error: Cannot add or update a child row: a foreign key constraint fails (strikerms.riskvalues, CONSTRAINT limitToBrokerKey FOREIGN KEY (limitsToBrokersid) REFERENCES limitstobrokers (limitsToBrokersid) ON DELETE NO ACTION ON UPDATE NO ACTION)"
I have a foreign key, but why should that be an issue?
:-(
 
6:50 PM
Has anybody seen Charles S lately?
 
Sprayberry?
 
yup
 
=== Total 395857 memory leaks detected === hrm...
 
@NikiC are we talking php releases?
:P
 
We are talking:
call_user_func_array(
    function(&$a) { },
    array_fill(0, 395851, '*')
);
obviously PHP didn't like that :D
 
6:54 PM
:-)
 
@Neal well it's an issue if you break the constraint...
 
if i have installed a php as an apache module and say i request a png file then would the process apache would spawn to handle that image request contain the php?
 
@lovesh Are you saying the image contains php??
 
@PeeHaa no i am saying that the process that apache would spawn would be same as a process that it would have spawned to handle a php request
 
7:10 PM
not exactly the same since it doesn't need php to parse it
Why the question if you don't mind me asking?
 
i was reading about the dangers of mod_php what i could sense was that in mod_php the php is contained in the apache process so the process becomes heavy
so i wondered if a process handling static content would be that heavy?
i mean would it contain php too?
 
Are you having performance issues? If so are you sure mod_php is the bottleneck? If not I wouldn't worry about it
 
@LightnessRacesinOrbit true true. and now i see i did... mine eyes fail me... :-(
 
i was thinking about going with nginx or php on fastcgi for my new project
so i wanted to know more abt how apache handles requests?
 
@lovesh maybe ask on serverfault?
 
7:23 PM
@PeeHaa guess ur right.
 
@tereško you online?
 
@NikiC oO
 
@PeeHaa , kinda
 
@tereško Do you know jQuery?
 
enough to know why it is harmful
 
7:31 PM
@tereško :) yeah yeah I know. But I'm a lazy fuck. ;-)
 
ok .. so .. what's the problem ?
 
@ircmaxell Yeah, it's kinda fun.
 
or are you offering me a job =P
 
@tereško neh no job offering. Besides tha fact that I'm lazy I'm also poor :) If I want to get the href from a link using jQuery should I use .prop() or .attr()?
I think attr, but I'm not sure
 
depends on what you are trying to get
attr() will give you stuff that is in the html tag attributes
 
7:36 PM
I only need to get the stuff in the href
 
then , yes , its $.attr()
 
@tereško k great. tnx man
 
8:01 PM
topics like this make me sad
5
Q: Why would is_int(sqrt(100)) return false

silkAdminDoes anyone know why this always returns False? is_int(sqrt(100)) and what syntax should i use to check is square root is an integer ?

well .. not the topic , but the answers and authors of the answers
 
Almost noone knows about filter_var($var, FILTER_VALIDATE_INT) So sad . . .
 
naah , thats not what i meant
 
@tereško loooool
 
I am saddened every time I see (int) $int == $int, that's all I'm saying.
(Side note, my little brother is learning C++. So proud!)
 
@LeviMorrison How little?
 
8:07 PM
29 .. ?
 
@NikiC He's sixteen.
 
@LeviMorrison Ah, so he's younger than me :P
 
He won a Java coding competition on the US State level last year, and is currently involved in a C++ competition.
If he wins he'll get a small scholarship.
 
@LeviMorrison Awesome ;)
 
I don't care about that nearly so much as the fact I can say my family has two programmers.
 
8:09 PM
Is having programmers in the family a good thing?
 
Well, I come from a small-town farming community in the middle of no-where . . .
Programming is shooting above the mark, if you get what I mean.
 
@LeviMorrison By some interpretations, yes ^^
 
@LeviMorrison , thats the general definition of Utah
 
@tereško I'm from Idaho :)
 
user895378
Wait, did someone say being hunched over a keyboard at all hours being a terrible hermit (like me) is "shooting above the mark"? :)
 
8:11 PM
well .. your profile says "Utah"
 
That's where I currently live.
 
@rdlowrey , you can click on the number-circle thing , to see when you were highlighted
 
user895378
@tereško If you're referencing your earlier Mac groupie response, I saw it. I started to respond with a bad joke with sexual innuendo then thought better of it.
 
I'd say I'm a decent programmer, but I didn't know anything besides PHP until I was 18. The fact he's involved in C++ and Java so young is great. That's my opinion, anyway.
Admittedly his C++ program is not that great.
But they program with severe time restrictions, so working product is more valuable than proper coding.
I don't think they do a lot of corner case testing either.
I'm not entirely sure.
 
You is "they"?
Quick poll: What would you think about dataloss warnings for type casting?
 
8:29 PM
@NikiC 'They' being the competition administrators in the latter, and the student programmers in the former.
@NikiC Don't care ;)
 
It seems like a reasonable first step towards weak type hinting.
 
@NikiC :-P
 
Honestly, the only thing from PHP I'd like change as far as typing goes is that I should be able to do function parameter type-hinting on string, int, and float.
I understand that type juggling makes it more difficult than it should be.
It isn't impossible.
We already have FILTER_VALIDATE_* for them.
If it's coming from user-land, I need to do the checks manually, of course. But type-hints make it easier to protect myself from my own coding.
 
@ircmaxell Do you think that it would be viable to add warnings for casts like (int) "foobar" and then use the usual type casting semantics for type hints?
I think I agree with tyrael that that's the best way
This prevents the discrepancy between the two type juggling behaviors
And also I think that we warnings are generally reasonable
It happens too often to people that they (re)discover that 0 == "foobar"...
 
I didn't know 0 == 'foobar'. I thought 0 would be falsy and foobar truthy.
Of course, I never play around with this stuff. I do really solid === checks most of the time :)
 
8:42 PM
@teresko i finished that antipatterns book... definitely changed my perspective on database design and maintenance. what were those google tech talk links again?
 
just search for "clean code talks" on youtube
there will be 4 videos , the one where title is "unit testing" is about a specific tool for java that they use at google ( thus worthless to you )
 
ok cool thanks
 
there are also : vimeo.com/13439458 and vimeo.com/13702091 from UncleBob
and php-specific video about OOP : vimeo.com/21173483 ( though do not trust all you hear about DIC .. that part is mostly last years hype )
 
i'll check em all out. really appreciate the references man
 

« first day (503 days earlier)      last day (4428 days later) »