« first day (916 days earlier)      last day (4257 days later) » 

08:02
@kaᵠ The icons live in the main app repo, something that could possibly do with being changed.
Mornings
@TillHelgeHelwig the OP replied to my comment, and now I am not so sure about what I said earlier. I will test the code and see what it does. I never use mysqli_multi_query...
@Jocelyn Sounds like a ridiculous concept somehow. I can't see any use in it.
@TillHelgeHelwig Same here. Maybe the OP believes it is optimized, but actually the code necessary to process both SELECT is more complex.
@Jocelyn And it only makes sense if both tables have the same columns. Otherwise it's pretty useless, I think.
@Jocelyn multi_query() is the way to open yourself up to proper bobby-tables style SQLi. The only time it has a practical application is when you have a lot of static queries that will all return fairly small result sets, because it reduces the network overhead. As a fairly good rule of thumb, if you think you might need it, you don't.
08:08
@DaveRandom OK, so this is another case of useless micro-optimization
Indeed, and most of the time it's not even an optimisation.
@kodewrecker failed.
:) all working @DaveRandom
08:21
:-P
@hakre Not a dupe
Different question
Yet another syntax error.
Similar, I admit, but they are different
08:23
Good monring!
:8942015 Jack CW to the rescue! :)
@DaveRandom the general type of misunderstanding is shared. Therefore telling OP this is duplicate should allow him to resolve all conflicts this per-se has into the answer then.
@Jack That's an awesome idea
You think we should close as too localized, right.
But you miss that after fixing the syntax error, the next question is about why the hash does not get passed to browser from location header ...
@hakre Not sure about that. I think he understands that the anchor is client side, he doesn't seem to be trying to read it in PHP.
08:25
Yeah ... the dupe doesn't seem right.
Well, let's see what OP says.
header('Location: index.php?s='.urlencode('Thank you for your message.')'#contact')
@hakre I'm not sure it should be closed at all yet, the OP hasn't responded to the syntax error part, it might have just been copypasta in the question.
Also not a fan of the -3, it's actually not a badly asked question.
This question isn't a duplicate of the linked question. In the linked question the OP wants to read the current hash and mirror it in the new URL (which isn't possible). OP here doesn't care what the hash already was, he just wants to set a new one (which definitely is possible) — Gareth 2 mins ago
^^ this
Yeah, Gareth is likely to be correct.
I hate how SO states I voted for duplicate.
@TillHelgeHelwig I stopped caring about my misrepresented votes ;-)
In any case, once it's reopened most people won't see it any more.
@hakre Nah, that person actually knows what they're talking about ... haha
OP here actually claims to not know PHP at all.
Question starts with "I have a Javascript array of unknown length" ... unknown, really?
@hakre Yeh that's kind of a dupe
This is very odd. It seems that someone at the W3C doesn't understand how fragments work :-S
When I try to add anything like this to make it scroll down to the anchor bookmark the browser hangs on the contact-form-submission.php page (separate php page for the contact form logic)
^^ that's a bit odd though.
@DaveRandom Why do you say that?
Yeh "hangs" is pretty ambiguous. Not sure if he means WSOD (in which case it is probably just the syntax error) or if he means that the browser actually freezes, in which case he's probably outputting a ridiculously anchor-heavy HTML page and the DOM is crashing looking for the anchor.
What's described there makes sense to me.
08:38
@Jack It seems to suggest that the fragment is being send to the server. And also the whole thing is just generally wrong. An anchor identifies a specific part of a specific document, of course it doesn't carry over to another document.
mroning
@DaveRandom No, it doesn't; it's talking about what user agents should do when a header redirect is done.
Suppose that a user requests the resource at w3.org/TR/WD-ruby/#changes and the server redirects the user agent to w3.org/TR/ruby. Before fetching that latter URI, the browser should append the fragment identifier #changes to it: w3.org/TR/ruby/#changes.
Yes, exactly.
^^ suggests that the browser is sending the fragment to the server
Before fetching the latter URI
Fragments are applied after the entity body has been received
Applying an anchor before fetching the document it applies to makes no sense
08:42
The fetching is done by the browser.
arrrghhhh
What do you tell somebody who is required to write something in PHP4? Only thing I can come up with it "Sorry for you".
Hello, any Symfony2/Twig gurus here? :) I'm a noob with symfony and I've got a quick question about translating text with variable implodes. {% trans with {'%name%': 'Fabien'} %} is clear in the documentation, however - what if I want a dynamic name instead of fabien - how do I utilize template vars instead of "Fabien" ?
@DaveRandom Well, as you can witness from the browser, you may notice that the location bar has been updated before the body is loaded.
@TillHelgeHelwig I still occasionally have to write stuff for PHP4. So does Uncle @Gordon IIRC.
08:43
Once loaded, the fragment is used to scroll.
This was perfect. Thanks Jack. — user2298352 6 mins ago
Okay, that solves that lol
@DaveRandom No it is not suggesting that.
@DaveRandom Because you have to fix or extend some legacy stuff, I guess?
@Daniel Not sure, but have you tried {{ username }}
And make a username var?
@TillHelgeHelwig Because of a very specific embedded MIPS Linux platform for which has no native compilers and for which I have yet to successfully create a cross-compiler.
@Jack lol
TL then
@DaveRandom not for very much longer. the system is undergoing a server migration right now and will have 5.3 then
08:46
@Gordon Yay! Updating a dead platform to a more recent dead platform
@Jimbo I'm stupid.... Just declare the variable with the translated text and it's good to go. Thank you! I'm getting tired :D
@Gordon is shirking his friday responsibility now that he's a mod!
@DaveRandom that's actually Debian's fault. there is no more recent php. D7 will have 5.4
@Daniel No worries, I haven't even written any code for Symfony 2 yet, just slowly going through the docs :) good luck!
08:47
@Gordon Oh it's not that ridiculous "5.3.7" with a load of backports is it?
i think its pretty sad how far behind the debian package manager is behind php stable
Isn't that pretty much the definition of Debian?
what, to not be stable?
08:48
@Jimbo nah, by now all of you know how to find Rebecca on the net on your own. You are grown ups now :)
@hakre I can't make any sense of it any other way. And the only way I can make sense of it makes no sense.
@Petah Stability by updating to newer versions after all the world tested them for over a year.
Understand that? No, me neither.
@DaveRandom I dont know which version it is exactly. I'm paying a sysadmin for that migration
but not implementing security releases straightaway?
08:50
Olalala my datbase is running crazy
Is there an easy option to remove all records an set them all back to 1.?
@Petah Well...they could break something. ;)
either way i still love debian and its the only server os we use
@DaveRandom the much deader part actually will be the cakephp version btw. It's running 1.1 atm and I will to upgrade it to gasp 1.2 in the process
@TillHelgeHelwig break something vs allowing someone else to break everything
@Duikboot , truncate table to remove all records
08:51
@DaveRandom It is just that: The location header value actually is an absolute URI. However in the past this was not strictly treated like it. Now rendering the problem whether or not to apply base URI resolution rules and based to what.
@Gordon Well all I can say is have fun with your E_DEPRECATED-fest. It sounds like the whole System Is A Lie, not just The Cake.
@Gordon every body likes cake
@DaveRandom you can always turn E_DEPRECATED off
@DaveRandom they claim 1.2 is compatible with 5.4 but all I can see is them enabling E_STRICT
Therefore the idea was that the client is allowed to keep the fragment but must take the new URI. If the new URI has a fragment, the client is not allowed to keep the fragment from the previous URI.
That actually is thoughtful under the premise that the URL in the location header line is an absolute one.
@Gordon It's PHP. There's so much BC you can probably run PHP3 code on 5.4. Doesn't make it a good plan though :-P
08:53
@DaveRandom you can't, they removed magic quotes
And when you follow the "fixes" so far suggested for that part of the RFC, then you see that the board is not really able to bring together de-factor processing, URI resolution rules and HTTP here. One of the RFCs is often violated, regardless which suggestion is being made.
@hakre I disagree. The fragment is part of a document, if you change the URI you change the document.
@Petah You could always reintroduce that with auto_prepend_file. ;)
@DaveRandom Luckily the URL is only the location of the document (in HTTP), so the fragment is nice to have, but just informative.
Sounds like bending the rules to accommodate hashbang URLs, which were a nasty hack to fix some terrible design decisions on the part of a large portion of the dev community. People made mistakes, they should learn from those mistakes, not write the workaround into the standard.
Or possibly allowing people to use the fragment as a client side data store. Which is more standards abuse.
08:59
Whether it was a good idea to "port" fragments to new location is of course something else entirely :)
@rdlowrey would not be impressed. And you do not anger orange people.
Well, it makes sense. If the location of the document changes and the document is the same, the fragment works and can be appended.
3
A: php preg_replace remove thousand separator in a string

m.buettnerIf you have a look at the preg_replace documentation you can see that you can write captures back in the replacement string using $n: preg_replace('#(\d),(\d)#','$1$2',$str); Note that there is no need to escape the comma, or to use i (as there are not letters in the pattern). An alternative ...

^^ I wonder what's more efficient here.
Are look-arounds better here?
@hakre Yes but what if the document is not the same? What if in the UI I've effectively redirected someone from a.com to b.com, but the URL still says a.com because I'm proxying b.com? It shouldn't be the UA's decision to carry the anchor across, it should be the servers. The server should know what its serving, the UA shouldn't assume anything.
@hakre I would say ... in ~95.6753% of the cases, the document is not the same :)
09:02
@Jack I much rather wonder about the intention of the OP. ;) Usually those , in long numbers improve the readability. People do weird things.
Or maybe it's a localization issue.
@Jack Then using a HTTP 301/302 redirect most likely is wrong. - Use HTTP/1.1 303 See Other
@hakre ??
Is 303 properly supported though?
@Jack If you want to remove specifically a thousands separator you know there are always 3 digits followed by a word boundary to the right hand side, and there is always a digit to the left. So I would do /(?<=\d),(\d{3})\b/ => $1 personally.
The server could do redirects for various reasons though, like click-thru tracking.
09:06
@Jack If you get a HTTP/1.0 request you might want to use 302. However I've not seeing HTTP/1.0 requests lately. That protocol was not longtime in use.
@Jack Could, but only under the premise that most user-agents have neglected the specs that making redirect automatic is not necessary.
@Jack 303 is properly supported, it's 302 where the ambiguity lies (in that most browsers treat it as a 303 when they shouldn't really).
@DaveRandom Sure, I was just wondering what would perform better :)
@hakre A lot of auto-provisioning clients for things like IP phones use HTTP/1.0 in their request line, although they also send a Host: header and implement chunked transfers so they are to all intents and purposes 1.1 clients.
Well, Host: was introduced in 1.0 :)
Oh and cURL does the same thing until quite recently IIRC
09:09
Chunked transfer is something else of course heh
@Jack Yes but it wasn't mandatory
And there we go again, boss asks for a visible update for the client.. >< Im still creating the backend
It's mandatory in 1.1?
Not cool
09:10
@Duikboot Get used to it :)
@Jack It is, it's the only mandatory request header for every request.
lol .. cool :)
I remember cURL had these odd issues with 1.1 servers; you would get stuff like pre-condition failed :)
So you had to force it into 1.0
Or ... ehhh what, remove some header I believe.
@DaveRandom If your server gets a HTTP/1.0 request, best thing is to send a HTTP/0.9 answer - just for the fun of it :)
All HTTP/1.0 clients need to support it, so you can fool them around a little while being stinkin' valid :)
09:14
Or HTTP/2.0 Okay
@hakre lmao
F*ck response headers, just have a document.
Yeah, make another request for the headers :)
@Jack HTTP/2.0 2000 21st CENTURY MOFO
HTTP/2.0 400 Bad Request - How About You Put Your Hand In Your Pocket And Buy A Device Made This Millenium
It's that guy again.
09:21
@Gordon: Can you see the flag and does it make sense? stackoverflow.com/questions/15795051/…
@DaveRandom 141 questions with < 500 reputation is quite an achievement.
@hakre yes and no. no mainly because I dont get what the OP is trying to do
user652649
morning
Hello, @wes
user652649
hello
09:27
morning @wes
user652649
hey Jimbo :P
@hakre also, the answers would not make sense if I merged them
@Gordon Nah, the object one is the only right one.
find . -mtime +1 -print0 | xargs -r0 /bin/rm -f =D
@DaveRandom when people request a merge, we read the answers from the source question in the context of the destination question. If there is too much mismatch, we won't merge. And I think there is too much mismatch in this case.
@Gordon So we should downvote and then delete the "bad" answers first ya? :)
@Jack the other answer is not wrong
we usually prune out some answers when merging, but I dont see why I should prune that one
@tereško Not too much cv-trolling that user or we'll get told off again. Although you could probably burn at least 75% of their questions, I had a look before.
09:38
@Gordon I was just kidding of course :)
i already am at my limit
@Jack I know. Just wanted to explain the options and the process ;)
Merging was one of the things I was really looking forward to. But now that I know how it works it leaves a lot to be wishing
mornings
Q: I have an object that does not implement Serializable, but must be serialized and I'm currently using __sleep to avoid modifying it's interface. This causes problems with private properties. Does anyone have a solution that doesn't involve implementing`Serializable` ?
@Ocramius what problems?
09:42
@Gordon private properties returned by __sleep cause warnings when they are in parent classes
@Ocramius hmmm
@igorw re: dunkels.com/adam/phpstack - I can implement anything in 600 lines if I only implement 1% of it and write sh*t code to do it. I'm not that impressed tbh. I actually started doing the exact same thing once, I've not touched it for ages but I know that my still very partial impl has well over 10x that amount of code.
so far the only solution I found is using reflection and Serializable. I wanted to basically avoid implementing Serializable to avoid changes in how the object is recognized
@Ocramius I understand all of what you are saying apart from that last sentence.
lemme patch up an example
09:48
@DaveRandom eval.in/16800
    class A
    {
        private $b = 'foo';
    }

    class B extends A
    {
         public function __sleep()
        {
            return array('b');
        }
    }

    class C extends A implements Serializable
    {
        public function unserialize() { /*... */ }
        public function serialize()
        {
            $b = new ReflectionProperty($this, 'b');
            $b->setAccessible(true);
            return serialize(array('b' => $b->getValue($this)));
        }
    }
Hello. I want to add this Flash presentation into my page: http://www.smartmedia.com.pl/assets/Prezentacje/UnitechHT680-2_basic.html

The problem is - it's too big and I can't edit the contents size using Iframe.

Is there any other solution, like downloading swf file with cURL or something?
but http://www.smartmedia.com.pl/assets/Prezentacje/orbitvu12_basic/orbitvuer12.swf is a blank page :/
:8943572 Ahh OK. Can't you just strip the var out though?
@DaveRandom ah, the code is somewhat misleading. sorry. it should be eval.in/16801
@Uchiha Obito - nvm. i just got it working with pure html
09:53
@Gordon ...but $foo doesn't exist. It's a private member of the parent class. Bar doesn't have a $foo, only Foo does.
@Ocramius Wait, what? Why would you want the value of $b when serializing C ? C doesn't have a $b. Now I'm totally lost.
@DaveRandom Bar does have $foo. remove the __sleep and it will serialize with foo
@Ocramius since you are using __sleep I assume you need to do something special to that value? because eval.in/16802
What the hell man. None of this makes sense. The child doesn't inherit the parent's privates when you're actually doing stuff. Why does that suddenly change for serialization?
@Ocramius also, this would work:
public function ___sleep()
{
    return array('foo' . chr(0) . 'foo');
}
because that's how PHP signifies private properties
@DaveRandom it does inherit them. It has to. It's part of the state of the child instance. It just doesn't have access to it. Think of it as "subconsciousness". You cannot tap it but things you do might draw on it.
Oh wait I get it. Because inherited methods would have access to them.
I seem to have Monday-itis
I clearly need Moar Rebecca.
@DaveRandom im currently listening to open.soundrop.fm/s/WDDQVu71g3kzX6Po
10:06
@Gordon I need Moar 3,4-methylenedioxy-N-methylamphetamine to be able to cope with that :-P
@DaveRandom i never tried that. Actually I find this channel quite enjoyable without
heh, first @Ocramius asks a question. then he vanishes
ping -t @Ocramius .... ^C
@Gordon You crazy Germans...
sorry, was forcefully grabbed by co-worker
And I thought you just listened to The Hoff 24hrs a day.
/me reads backlog
10:10
@DaveRandom aint this all variants of I've been looking for freedom anyway?
@Gordon wait... WHAT???????
@DaveRandom wow. his face is so shopped in that pic that he looks like a Hubot in this one
@Ocramius you didnt know? :)
@Gordon what sorcery is this?
so echo $this->{'foo'.chr(0).'foo'}; works? O_o
@Ocramius well, I figured the array you return from sleep will try the names in the array as properties. and since php uses privates with that null byte notation …
10:15
@Ocramius Yeh it makes it a complete nightmare for transmitting them over raw UDP sockets (don't ask), been bitten by that one before. You have to bracematch on the fly because F*CKING Windows treats a null as a packet boundary in text mode, and if you read them in binary mode it has tendency to hang on data wait even when it hits a real packet boundary.
@Gordon this is madness
@Ocramius it's php. what did you expect? does it at least work for you usecase?
@Gordon yes, but I'll have to send (yet another) test case to php-src to disallow breaks
seriously though
what the fak
yay! I am helpful! \o/
Nice! I got a hotel right around the corner from where PHPUCEU is in Berlin
10:17
If an object is converted to an array, the result is an array whose elements are the object's properties. The keys are the member variable names, with a few notable exceptions: integer properties are unaccessible; private variables have the class name prepended to the variable name; protected variables have a '*' prepended to the variable name. These prepended values have null bytes on either side.
@Ocramius you could make it into a question. Then I'll answer it. just if you want. i dont mind if not.
@Gordon It's kinda rtfm, even if it is a bit of tfm that people would pretty much never need to read
@Ocramius this does not work though apparently: eval.in/16805
Argh mod_fcgid: stderr: thrown in
erreur
@Ocramius ah wait. I was being stupid. it has to be eval.in/16806
rargh, co-worker again, sry
@Gordon you just made my stuff 1000000 times faster
ok, bbiab
thank you!
10:27
@Ocramius I'll send you the invoice via mail :D
@Ocramius you're welcome
And when putting everything online the whole system crashes - _-
@Gordon I was talking some days back about very important/useful information getting lost in here... shouldn't this be a question on SO? For future reference.
user652649
guys how would you prefer organizing templates? like this nopaste.info/bb0c8c6d3c_nl.html or like that nopaste.info/f0505c1886.html ?
@iroegbu I am not sure it should be common knowledge. It's hackery and the more sane approach really is to use Serializable as noted in the manual
array_filter() expects parameter 1 to be array, null given ...
$filteredData = (array_filter($data[0], 'is_not_zero')); offline does it works perfect
10:32
there are other instances of good questions popping up here
@Duikboot Do a var_dump($data) before that line. There is probably something wrong with its content.
@wes Neither. I prefer the template inheritance of Twig. ;)
@DaveRandom nice. but in that case, you dont need __sleep at all because that's what serialize will do anyway when no __sleep is given. It's basically just a matter of knowing how to access the private properties when you want to do it selectively.
@Duikboot still struggling with this? :D
user652649
10:35
@TillHelgeHelwig :(
Offline it's working :) online i receive errors
/ lunch
Lunch is a great answer to most problems. ;)
@wes Before I knew Twig I used your second approach most of the time. Felt easier and cleaner to me than having a lot of control flow stuff in the templates.
@Gordon I shall crawl back under my rock now :-P
@DaveRandom it's still nice. just unneeded in that form
10:42
Is posting answers as community wiki a new trend? Haven't noticed that before and seen it several times today already.
@TillHelgeHelwig When it's a TL I see no harm in posting answers to let the OP know what they did wrong, but I still vote to close. By making the answer CW I won't get any rep and I won't lose any rep when the question inevitably gets deleted.
Ah. Thanks for clearing that up.
Sometimes I think it would be good to have a different way of handling too localized questions.
user652649
@TillHelgeHelwig never heard about twig but it is nice, i may think to use it. does it allow creation of custom functions? for example actual php methods/functions accessible within templates? not data previously assigned to the template, but "live" results
@wes As far as I know you can create any type of custom filters to be used in the templates.
I don't like the whole concept of twig, it seems like a massive overhead for not actually adding any functionality. PHP is already can already be used as a templating language. But I know many disagree with me here.
10:48
Concerning too localized questions: Maybe it would be better if the question would stay open for a few days and then gets deleted or something. Because the OP will be very glad to get help, but there will not be any benefit to the community from this question.
user652649
@TillHelgeHelwig ye it seems like that
I don't like how questions are being closed immediately after being posted, because they are too localized. The OP still needs help.
@DaveRandom Sure. But the same goes for Smarty and all the other stuff out there.
@TillHelgeHelwig Yeh as soon as the OP responds with "thanks" I will delv, but not before then.
@TillHelgeHelwig Indeed.
And Twig is actually fun to use compared other template engines I've seen.
And I see the argument that designers have problems with PHP in templates as a valid concern.
10:51
so instead on learning basic PHP , you want them to learn a templating language
And using a template engine prevents the implementation of logic in the templates at least to some degree. If you use only PHP, its a matter of discipline. ;)
.. this train of thought has always fascinated me
user652649
what about recordsets loops? when you do, for example "for(contents as content)", "contents" is all in memory (fetchAll) or it can be made row per row (single row fetch) cleaning memory at every cycle?
@TillHelgeHelwig if you do not have discipline to write good code, maybe you should look into alternative job opportunities
@tereško Not talking about me. I'm talking about what happens in most environments where several people work on the same project and have to match a deadline.
Things get fixed quick and dirty and at some point stuff gets mixed up.
10:54
here is something nobody has told you: when you write crappy code, you will end up fixing it again and again and again
if you do not have time to do it, then you certainly do not have enough time to do it twice
Anyway. The main argument I have accepted by now concerning the use of a templating engine is that many common editors (like Dreamweaver) tend to mess up with embedded PHP tags, because they use <>. So {{ variable }} works much better.
bullshit
@Gordon I know and I agree. ;) Complex logic has no place in view code.
10:56
so why are you adding another layer of complexity, by introducing another "language" ?
@TillHelgeHelwig I mainly linked it because of that argument about designers. It's what folks commented to that answer too. Check the EDIT part. Of course you could use a Template Engine but it feel superfluous when you can achieve the same simplification with PHP alone
@TillHelgeHelwig templates !== views
who wants some bounty?
2
Q: How can I validate array keys using Symfony Validation?

PetahHow can I validate array keys using Symfony Validation? Say I have the following, and each key of the emails array is an ID. How can I validate them using a callback, or some other constraint? $input = [ 'emails' => [ 7 => 'david@panmedia.co.nz', 12 => 'some@email.add', ...

user652649
@tereško stop that please... as always you have chosen the wrong way to tell your arguments... :P
user652649
@TillHelgeHelwig what about recordsets loops? when you do, for example "for(contents as content)", "contents" is all in memory (fetchAll) or it can be made row per row (single row fetch) cleaning memory at every cycle?
10:58
@wes we all learn to take @tereško with a little bit of salt
or black coffee
@tereško I don't like the way you "discuss". It's unpleasant. So I guess I'll stop at this point, and go back to what I was doing.
@Gordon rofl :D
why is it that real code in symfony always looks like an impenetrable wall of text ?
@tereško it doesn't, it looks like Java
10:59
2 mins ago, by wes
@tereško stop that please... as always you have chosen the wrong way to tell your arguments... :P

« first day (916 days earlier)      last day (4257 days later) »