« first day (675 days earlier)      last day (4287 days later) » 

user895378
7:00 PM
Lazy never starts the project. Losing motivation and trailing off is human nature.
 
rdlowrey ... for e.g: first day, I work for 6 continuous hours..., that's for one week... the next week I work hardly for 4 hours , then I decreate my rate gradually untill giving up
 
@NikiC You object?
 
@MikeB no.
@MikeB Did you already vote for it? It needs one more vote I think
 
it requires 5 .. we got 3
 
I did
 
7:05 PM
ah, it needs 5? where can you see that?
 
Can anyone help with a Smarty variable scope question? Is scope strictly limited to each template when using inheritance? (stackoverflow.com/questions/11956543/…)
 
@NikiC , it tells you when you vote
 
@webarto Nope, can't change anything
 
need help on something @NikiC?
voting something?
 
@JordanRichards You don't have enough rep yet to cv or delv ;)
 
7:10 PM
@MattS we solved it by adding a helper that gathered data in an object a while ago. think nothing has changed since smarty 2.
 
o.
Sorry I'm new
and I got banned from posting questions..
lol
 
@All... see you later, thanx for discuss.
 
silly me
 
@meze thanks I tried that and it didn't stick. I tried storing in a static object property and no luck, value gets lost.
 
user895378
0
A: Why am I getting mime-type of .csv file as "application/octet-stream"?

rdlowreyIn times like these, the official HTTP specification is always helpful. From RFC 2616 7.2.1 (my emphasis added): Any HTTP/1.1 message containing an entity-body SHOULD include a Content-Type header field defining the media type of that body. If and only if the media type is not given by a Cont...

 
@rdlowrey Gladly.
 
user895378
Rep-whoring my way to 10k ... every day ... one answer at a time.
 
*20k
 
user895378
Oh true, 20k is the real prize.
 
7:30 PM
the 10k delv is a joke ^^
 
@MattS there's registerObject, no need to use static stuff. Just checked it and it worked
 
user895378
can't you see deleted stuff at 10k as well?
 
@rdlowrey yep
 
user895378
yeah, I need that.
 
7:31 PM
and stackoverflow.com/questions/282884/… isn't even closed yet!
 
CAM
Git is Awesome and I need an argument killer.
 
@CAM git sucks. I mean rebasing of commits? really? who would ever need such an ungodly concept...?
 
CAM
I have a dev that says that .git files will add overhead to the server and impact the production environment, I am afraid I may do something i regret.
 
HUH?
 
CAM
@ircmaxell not sure i have dealt with that yet, its been pretty good for me
 
7:33 PM
overhead to what server?
@CAM my comment was completely sarcastic
 
why is it that 3rd party libs are always so horrible !!!
 
@ircmaxell Is that sarcasm?
 
@meze So I can't use a static method on an object that references an internal static property? I have to register an object instance before rendering the template? I hate workarounds.
 
CAM
@ircmaxell ahh
 
@NikiC yes
 
7:34 PM
@ircmaxell good
 
user895378
@tereško The ancient truism: If you want something done right, you have to do it yourself :)
 
CAM
@ircmaxell he is say that the prod server should have no sorce control files on it
 
@rdlowrey , but i don't want to do anything
has spent whole day researching OpenID
 
@CAM I'll put it to you this way. I run servers that get 100's of millions of page views per day. having source control on there makes life a lot easier and has no performance impact
 
CAM
which baffles me as to how it would hurt the prod env., it would add accountability and tell us what was changed and when,
 
7:35 PM
@ircmaxell I am thinking about how one can approach porting PHP to an AST-based parser
 
@CAM exactly...
 
CAM
Agreed
We run 20 servers hitting close to 800 million /day
and when we go down its not pretty
hence my push for Git over svn or darcs
get this he wants springloops too, to make the deployment "easier" What??? its not easy to issue one command for deployment / update?
im sure you agree with my frusterations
 
springloops?
 
user895378
@tereško My experience has been that implementing new-ish standards always seems to be painful (re: OAuth) because adoption isn't totally widespread, resources aren't as ubiquitous as they might be with more mature standards and often it takes a large group of people a bit longer to distill the most needful requirements into a single specification :/
 
@MattS i think it should work with static properties too. but that solution is ugly
 
user895378
@tereško All that to say, I feel your pain.
 
@CAM any provider who lists customers, none of which you recognize, is a bad sign...
 
CAM
I do not think we need to incur any costs if we are competent enough to read documentation
@ircmaxell Agreed
 
just use git and be done wiht it
 
CAM
7:42 PM
thats what I said
 
@meze thanks i'll keep playing with it... this template variable scope seems like a silly limitation on smarty's part
 
CAM
but the file overhead Q is in the air and due to his seniority i find it difficult to address the issue b/c he does not explain his reasons
 
@CAM what file overhead?
 
CAM
@ircmaxell Exactlly!!!
 
CAM
7:44 PM
BAd ASS
thx
 
@rdlowrey , in your opinion , should i make a cURL wrapper ?
 
user895378
@tereško For what?
 
that openID thing needs to send GET/POST/HEAD requests all over the place
 
user895378
php's curl_* functions work just fine. The problem is that IMHO the API is extraordinarily unintuitive. With the curl functions you also have the issue that you're relying on a dependency in libcurl that may or may not be available. My experience is that this can sometimes be difficult to acquire in windows environments.
 
@MattS actually it will work as you want with variables if you declare it outside of the {block} block
 
7:48 PM
i cannot recall the last time i was running php-stack server in windows
 
user895378
I'd say if you're comfortable with the curl_* functions, go right ahead. Alternatively I can pretty much guarantee that my HTTP client will be version 1.0-ready and fully tested within the week if you want to use that instead.
 
@tereško It's more worth your time to write an HTTP client using streams or sockets than lib cURL.
 
@meze you mean in the parent template (e.g. page.tpl)?
 
@MattS no, i mean {block name="head"}{$page_var = array("abc", "xyz")}{/block} -> {$page_var = array("abc", "xyz")}{block name="head"}head block{/block}
 
user895378
:5026506 Sure -- be aware it's broken at the moment because I pushed some in-progress changes so I could discuss them with @LeviMorrison :)
 
7:51 PM
it'll go into the global scope then
 
@meze according to the documentation you're not allowed to have anything outside {block}, so I haven't tried it, but I will now!
 
@rdlowrey Looks like a lot of complicated stuff. Will have to look more closely later
 
user895378
@NikiC If you just want to see the API (recommended): gist.github.com/3251540
 
updates ZF to 1.11.12 ... 1.11.13 came out...
 
7:55 PM
Ah, I see it's using @LeviMorrison's data structures already
 
@NikiC Uses it at its own risk :)
 
user895378
:)
 
Bloody unstable repo, data structures is.
 
user895378
Spl\TypeException + Spl\HashingMediator work pretty well though
 
@rdlowrey MULTI-REQUESTS IN-PARALLEL, is it similar to curl_multi_*, I mean your code waits until each request is completed in order in what it was initiated? (sorry, didn't come out in English)
 
7:56 PM
@LeviMorrison Btw, I think that it doesn't make sense to develop them against an Spl namespace. Imho the datastructures should get an own namespace (like `DataStructures` ^^
 
hashingMediator?
 
user895378
@webarto no order -- all the requests are made and retrieved in parallel
 
@NikiC Well . . . originally it was just meant to replace the SPL data structures.
Then I decided it should replace MOST of the SPL.
 
@LeviMorrison Yeah. But thinking about it I think it should be separate
 
user895378
@webarto As soon as all the responses come back the function returns with an array of the responses with the same keys as the array/stdclass/traversable that was used to send them.
 
7:57 PM
Generally I don't like that Spl is the ext where one just puts "all the stuff" in ^^
 
@Crontab so then the user would actually have to do some work on their own ^_^ — Neal 6 secs ago
:-)
 
So, you are saying use \Spl\DataStructures or \DataStructures?
 
0
Q: Javascript doesn't rock on generated page (with jQuery & Pdo)

gregoire davyI'm quite new in html5 & js and i have some troubles to develop a pdo code exemple. From this exemple, i'm just calling another header (partial) for selected a product. _header2.php: <!DOCTYPE html> <head> <title>h2: <?php echo $_GET['product']; ?> </title>...

it doesn't work rock
 
if ($response instanceof Exception) { don't abuse exceptions
 
@rdlowrey $request->setAllHeaders($headers); does that replace existing headers or only add the new ones?
 
user895378
7:59 PM
@ircmaxell I know -- we had this discussion the other day and it's been addressed and changed locally :)
 
@LeviMorrison \DataStructures
 
@rdlowrey that is pretty pretty nice... just what I thought... keep up the good work.
 
user895378
@NikiC replace -- I have Client::appendHeader and Client::appendAllHeaders methods on the way.
 
@NikiC And the exceptions should go where?
 
8:00 PM
Hola
 
rrrg chrome wont let me install the cv-pls extension without the chrome store...
 
@Neal "Load Unpacked Extension" ?
 
@orourkek where?
 
even got cv-pls in the shot :P
 
@rdlowrey The sendMulti thingy looks interesting. curl_multi is really ugly to use (near impossible)
 
user895378
8:02 PM
@ircmaxell The problem I had was trying to figure out the best way to represent to the user that a network error occurred during parallel request retrieval. The exception has to be caught and isolated so that one request failure doesn't bring down all the others that are running in the multi-request. It doesn't make sense to return an ErrorResponse because there's technically no response.
 
I think that's how I did it, but it's been a while since I installed
 
@orourkek where do i get the unpacked version?
 
@Neal this smells like a chrome update that messed things up...
 
@rdlowrey If you are modelling the real world, sure.
If you are just giving a nice interface, not so much.
 
@rdlowrey don't want to sound like a jerk, but is it possible that response is returned as soon as it's processed... do you know what I mean?
 
8:04 PM
@orourkek .... I need this extension.... I forgot to get it on chrome...
 
@rdlowrey sure there is. A network error is a valid response case (non-exceptional)
 
@PeeHaa could probably answer that though
 
user895378
@ircmaxell so what's the HTTP status code for that response?
 
user895378
@ircmaxell Then what do you say about this:
 
user895378
8:06 PM
yesterday, by rdlowrey
I don't know, you could easily introduce errors in your program if you forget to do a check for if ($response->getStatus()) and start accessing things with $response->hasHeader('X-MyAuth-Header') ...
 
user895378
yesterday, by rdlowrey
I think correctness is more important than robustness there -- I'd prefer someone get the exception from calling a method that doesn't exist on a returned failure object than not realize something was amiss.
 
user895378
@webarto Actually, I have that in place already -- just a sec I'll explain.
 
@ircmaxell That's not even close to standard.
 
@LeviMorrison nothing is close to standard, because there is no standard
 
8:08 PM
@ircmaxell If you consider RFCs standard, then you are terribly, horribly wrong.
If you don't, then yeah, you are correct.
 
PDO Is epic
:D
 
@LeviMorrison what does the RFC say about handling network error
 
user895378
@webarto The Client broadcasts events when things happen. One of those events is Client::EVENT_RESPONSE_COMPLETE, so as a result, you can -- in the midst of a multi-request -- do something when a particular request finishes by specifying an event listener like so:
 
user895378
$mediator = new HashingMediator();
$client = new Client($mediator);
$mediator->addListener(Client::EVENT_RESPONSE_COMPLETE, function($response) {
    // do something with the response body
    echo $response->getBody();
});
 
user895378
Each time a response finishes the Client::EVENT_RESPONSE_COMPLETE event is notified with the completed response object.
 
user895378
8:10 PM
Even if all the other requests in the parallel group have yet to complete.
 
@ircmaxell Oh, I see what you mean. That aspect is not defined in the RFC.
 
user895378
@webarto Granted, this is not multi-threaded, so any processing done in that listener will put the breaks on further retrieval until your listener finishes.
 
@LeviMorrison exactly
 
user895378
You could, though, fork a new process to do your processing without slowing down retrieval of the other responses ...
 
8:13 PM
@ircmaxell Java people throw exceptions.
 
user895378
Also, it's worth noting that each response entity body is stored in its own php://temp stream, so you don't have them all buffered in memory at the same time.
 
user895378
You can access the stream entity body with $response->getBodyStream(), but if you call $response->getBody() the stream's contents will be fully buffered
 
@LeviMorrison eih... I can see both being correct
 
user895378
That allows you to request many large files in parallel without hogging memory all over the place.
 
user895378
So in short, it's pretty legit, but still not totally stable :)
 
8:15 PM
It doesn't make sense to throw an exception when one of a group fails. So something like sendMulti wouldn't throw an exception. That's where a status code 0 would make sense. But on a single request maybe it makes sense to be consistent and return status 0, but I'd personally have an exception.
 
@orourkek ehhhh
 
@rdlowrey where is the buy me a beer button? :)
 
user895378
@LeviMorrison All of my refactoring headaches for the last two days have centered on this problem. I have Client::send and Client::sendAsync throwing exceptions if something goes wrong, but Client::sendMulti won't throw an exception unless something totally unexpected and un-planned-for happens. Any ClientException instances thrown are caught and a "placeholder" object is returned at the slot where there otherwise would have been a completed response.
 
stackoverflow.com/questions/5559549/… was successfully deleted!
 
8:18 PM
great
 
@NikiC w00t
 
CAM
0
Q: MongoDB Match 2 criteria

CAMGiven the Set in my Image Example, Is it possible to retrieve by ID and if 'element is in the array'? As you can see I can find all the records with the element in the array, but as I drill down and find the one by ID as well, it throws an Error, I suspect my syntax is wrong here is a link t...

 
@NikiC 9 votes?
 
@LeviMorrison or 8, not sure right now
 
8:25 PM
@NikiC now 7
 
@Neal thanks
 
i wish i could delv:(
needs moar rep
 
@Lusitanian As do @rdlowrey and I.
 
user895378
dear mods: just kidding :)
 
dear mods --> just kidding abt kidding :-P
 
@rdlowrey I wasn't kidding about beer or tan cream :P
 
user895378
@webarto I literally lol'd at "tan cream" ... still am.
 
@rdlowrey whaaat ... you know that little bronze bags that you rub onto yourself before sun bed to get that bronze statue color :D
 
8:40 PM
red bull, a liter-a-burn, coffee, dark chocolate = heart attack ... I guess I won't live up to 20k rep... yay
 
user895378
I seriously need to make myself a brogrammer gravatar ... oh ... wait ... nevermind.
 
user895378
@Neal NOOOOOOOOOOOOOO!!!!!!!!!!!!!!!!!!!!!!
 
@rdlowrey yes....
 
x-files?
 
8:45 PM
@Neal , at this point I think I should start hoping, that the "mayan end-of-world thing" works out
 
@tereško LOL that passed. it was months ago. They did not factor in leap years....
 
damn
 
One more upvote away from tieing the skeet
36
A: Is micro-optimization worth the time?

ircmaxellWell, for a trivially small array, $array === (array) $array is significantly faster than is_array($array). On the order of over 7 times faster. But each call is only on the order of 1.0 x 10 ^ -6 seconds (0.000001 seconds). So unless you're calling it literally thousands of times, it's not go...

 
@ircmaxell Such a points whore.
2
General question, what are peoples thoughts on ZF2? I've been playing around with it and see it as one of the better frameworks out there.
I know it's a loaded question and there's no real answer, want to see what people think.
 
@ircmaxell , here ya go
@ThePixelDeveloper , that's like being smartest kid in remedial class
ZF2 is still changing .. they say it is RC, but the codebase has hand at least one major rewrite in past month
also , it is actually is quite horrible under the hood.
ZF2.x developers still think that static is the best feature in PHP
 
8:58 PM
:-D
@ThePixelDeveloper Ummm... Ok. If you say so.
Jon Skeet, Reading, United Kingdom
473k 142 2219 3589
 
I haven't experienced too many static calls in the latest code.
 
Curious: do you guys like the way isset works with associative arrays? That is to say, that an array like this: array('music'=>null) gives this: echo isset($my_array['music']); // false? It frustrates the crap out of me because I always forget... it is so unsemantic. The array key music is set, you jerk function! I didn't say anything about what the content is.... grrrr.
 
@irc
@ircmaxell Jon Skeet is God
 
@Chris Yes, I do like the way it works. Because isset() tells me if the variable exists and is initialized. null means lack of a value, so how can you say that a variable is set if it lacks a value...
 
@Chris array_key_exists, amigo.
 
9:02 PM
In computer science, a pointer is a programming language data type whose value refers directly to (or "points to") another value stored elsewhere in the computer memory using its address. For high-level programming languages, pointers effectively take the place of general purpose registers in low-level languages such as assembly language or machine code, but may be in available memory. A pointer references a location in memory, and obtaining the value at the location a pointer refers to is known as dereferencing the pointer. A pointer is a simple, more concrete implementation of the more...
 
isset is poorly named.
 
> Are there people who need more than the 8GB of RAM that the lower-tier MacBook Pro w/RD offers? Yes. But if you’re one of those people, chances are you know it already. There’s no operating system or general software suite coming down the pipe that’s going to push the 8GB limit, nothing in the works that will unexpectedly turn your hard drive (assuming you still own a hard drive) into a chittering swarm of crickets.
 
@Chris It exists but is not set.
It's NULL.
 
@ircmaxell lol. i think he assumes the people who run photoshop know they need more
 
@LeviMorrison In my mind, if it "exists" (ie array_key_exists), then it is "set". I know array_key_exists is around, and that's what I mean 90% of the time I use isset on an array, only to have it kick me in the ass later. It is my fault, yes, but I still think that either the function is not very semantic
 
9:09 PM
@LeviMorrison @rdlowrey so here's the plan, lets ask lots of questions, upvote each others questions, answer those questions, upvote and accept those answers
and repeat ;)
 
The Skeet is nearing the 500k mark
 
To me, is_null is making a statement about the value of a variable, isset is not making any statement about the content, just the existence.
 
That amount of answers a day? Seriously?
 
@hookman He has answered so many questions he gets rep daily for doing nothing.
@Chris You are trying to warp isset into what you want it to be.
Skeet does answer a lot of questions, though.
 
9:11 PM
@hookman no, that number of upvotes per day
 
@Lusitanian Some of it, though.... stackoverflow.com/questions/6841333/…
 
John Skeet has 6 less gold badges than I have total badges...
 
@Chris the first comment on that...
 
I think that the upvotes on some answers (like the one I linked) are way out of proportion to the quality of the answer. That question I linked could have been answered by effective use of Google.
 
@Chris As are most of the high-voted answers on SO
 
9:13 PM
@LeviMorrison It isn't that I call for a change in the functionality, per se... but the thing still pisses me off (partly at myself for forgetting)
 
Except for example:
110
A: Find first character that is different between two strings

ircmaxellYou can use a nice property of bitwise XOR (^) to achieve this: Basically, when you xor two strings together, the characters that are the same will become null bytes ("\0"). So if we xor the two strings, we just need to find the position of the first non-null byte using strspn: $position = str...

that's difficult to find on google, because I first published it on SO...
 
c# has a huge number of people answering questions.
Tough to get rep.
 
- Are you a ringer? How did NikiC know you were planning on posting this?
- visit our courses of telepathy here http://chat.stackoverflow.com/rooms/11/php
 
0
A: How to avoid duplicate interface code?

Levi MorrisonThis is a case where you would want to use both an interface and an abstract base class. public interface IDatabaseProcessor { void ProcessData(Stream stream); } public abstract class AbstractDatabaseProcessor : IDatabaseProcessor { void ProcessData(Stream stream) { // setting u...

 
Should have told him to use traits and jQuery instead. That answer is too complicated, what with the information and the reading.
 
9:24 PM
@Chris lol
 
awesome
 
What is the purpose in the null-coalescing operator
 
Hey all .
Is it possible to allow people to upload files and let other people edit them?
like excel words etc.
...
if so, how?
 
@Lusitanian $y = $x ? -1; ?
 
9:29 PM
*?? but yeah
i guess it's just a simplistic way of writing a ternary statement fo rthe same thing
 
@Neal then you would have something like Google Docs, I think it pretty damn not possible for us mortals :)
 
:-\ But the files cannot be public
they are internal files.
We dont want google to have them....
 
PHPExcel
will give you the backend
you "just" need to write a frontend around it (:
though as i'm sure @webarto knows, there's a jquery plugin for that
it's not really that hard to do thanks to the lib
i believe there's phppowerpoint and phpword as well
 
...
 
...?
 
9:32 PM
$x = -2;
$y = $x ?: -1;
var_dump($y); # -2
 
@webarto yeah i know
 
$y = $x == true? $x : -1;
I guess... but note == ...
it think it is more confusing than leet :)
 
@webarto querypath.org jquery for php
 
idiots
I'll rather use regexp
$qp = $factory->getInstance($filename);
 
Mr. Yasuo is driving me nuts on the php mailing list for array_delete.
 
9:46 PM
@LeviMorrison pardon me asking, how did you get involved in php.net prototype thingy?
 
@webarto I had karma from editing the docs and I just started contributing.
@O.O The reason is that you may have another implementation that does not share any common code with the abstract base but honors the interface. This happens all the time with the Gateway pattern. — Levi Morrison 31 secs ago
 
@Lusitanian he doesn't give unaccepted answers? :D
 
that is his ONLY downvoted answer
 
@LeviMorrison kewl, gj
 
9:48 PM
well, negative score answer
 
should we upvote? :P
 
I don't understand why it is accepted then...
 
because it worked
wow, the C# async methods / await keyword seem very poewrful
 
but it is bad (worse then other)?
 
9:52 PM
new PDO, ftw!
 
@hookman none of the above
 
@Lusitanian exactly
 
we've all seen that :D
 
sad world we live in...
 
can't wait to see how wrong this is
 
9:53 PM
0
Q: Mixing up ordering of SELECT, WHERE, and FROM?

HubridHere is my php script: <?php $id = $_GET['id']; $query = "SELECT doc FROM docs WHERE id = '$id';"; $doctext = mysql_query($query); ?> A really, really simple one... I'm new to PHP/MySQL. It is supposed to get the id from the URL, which works fine. Then select the do...

 
Anybody set up phpunit and Zend test before?
 
zend what?
 
part of zend framework, zend test
 
zend framework, what version
 
@webarto i wasn't harsh
0
A: Mixing up ordering of SELECT, WHERE, and FROM?

LusitanianYour query is executing fine. Your issue is that you aren't retrieving any data from the result. The mysql_query function doesn't automatically retrieve data, you retrieve it in a format you desire using one of the mysql_fetch functions like mysql_fetch_row. Note that you really shouldn't be usin...

 
9:57 PM
1.11.11
 
@Lusitanian you are still nice :P OP is not a fag I guess...
 
lol
 

« first day (675 days earlier)      last day (4287 days later) »