« first day (839 days earlier)      last day (4335 days later) » 

17:00
Was looking for a quick solution before lunch.
@DaveRandom Yes. I still have that issue :(
@Baba Pong from my side too ;)
And I'm positive this question has been posted in some form or another, I just can't think of any good way to search it. Subarray rotation without foreach?
Welcome to quick solution PHP room on Stackoverflow. Give us a problem and we will solve it for you, while you are having lunch!
It's not really a rotation though, it's a summation, using each of the values as an index.
No, I said before I left for lunch.
But now it's time for lunch. So nevermind, thanks though. I'm not looking for a handout, I just couldn't find it via search. Sorry.
I figured it might be simple, maybe not.
@webarto I'd star that, but I don't want unknowing people to read it in the sidebar out of context :]
17:05
Before I ruin everything horribly... I'm working on a project checked out from SVN, I want to use git locally for a major feature, and gits branching is clearly far superior. I'm guessing the answer is going to be "nothing", but how much am I going to break by initialising a git repo in the svn checkout?
Hmm, first thought is, PHPStorm might get confused.
@Vap0r Just make it a question and add the link here
@Leigh Can't you tell SVN to ignore certain folders?
@Leigh tell git to ignore svn, tell svn to ignore git
@Leigh If .git is ignored, I'd say none...
@Korhan have you fixed it
17:13
Thanks, yea beyond the obvious, should be none, I hope
@Baba No.
quarrel with my php code.
lol..
That hurts my eyes now
@Korhan are you really sure it works on smaller files ?
Right, have a good weekend all :)
17:16
WOW what an annoying gif
@Jimbo So does mine. Have been hurting my eyes without rest on staring at code.
;)
Point made, can we edit that out now? @Korhan
@orourkek I know right!
or I'll just
@Baba I am really sure ya.
17:17
keep
typing
to push it up
@orourkek What?
@Korhan delete all tmp files ... restart your Apache, Clear browser settings etc and try again ... because i could not reproduce your error
@Korhan your horrendously annoying gif
Anyways it's out of page now @orourkek
17:19
3 mins ago, by webarto
ESC
@Baba Okay. But I can try only after sometime. Because I am not at my PC which has a setup.
@Korhan Oh ok
@Baba So, you are able to upload even large files with the same code! o_O
@Korhan 50MB
I can't forget it even when I am not at my PC which has setup. Lollzzzz.
17:21
@Korhan then 3.7MB Image
Then why it's been harassing me with no reason. I changed the settings in php.ini and restarted server many times and even my PC too.
@Baba Cya later. I gotta go to class. Will try deleting temp files and even settings with browser.
@all Bye.
@Korhan ok
@ThiefMaster who flagged a cat image? who would do that?
BAN THE USER!!!!11
17:37
We live in a cruel world.
That would be cool.
@ircmaxell all user ?
i am sure only guy like in that image can do
17:51
user652649
folks is there a way to know if an array is a reference of another?
not with 100% certanty... Without modification that is
user652649
uhm?
You can apply that to any variable.
What @ircmaxell probably means is, make some random array key/value, and check other array for that key/value.
Quite leet code. Remember to unset :P
of course
# decode base64 query string and import keys/values in GET superglobal
$queryString = $_SERVER['QUERY_STRING'];
$queryString = base64_decode($queryString);
if ($queryString !== false)
{
  parse_str($queryString, $queryString);
  $_GET = array_merge($_GET, $queryString);
}
Is this "safe"?
@Baba its really awesome
18:10
@NullPointer Yeah .... not bad at all
@ircmaxell As in, pushing user input data in $_GET superglobal. Basically I'm obfuscating parameter names and values with base64.
again, define safe
user652649
@ircmaxell right.. nice idea
do it more verbosely than that, but that's the idea
user652649
i think an object would give the 100% certancy
18:14
huh?
yes, you can see if two objects are the same: spl_object_hash
user652649
@ircmaxell i mean this codepad.viper-7.com/gBvx5l
@ircmaxell Disregard safe... is the only difference between this and "normal" GET parameter passing the fact that data is not urldecoded. :) (don't forget to smile)
@webarto eih...
@wes don't do that
you're going to force memory copies all over the place
Not sure why I'm asking...
don't use references in the first place, and you don't have to worry about it
user652649
18:21
can you explain me what exactly happens?... why memory copies?
if they are not references, PHP will make a copy so that it can pass it by reference to that function
example: if you did $d = $a before the call, then $a would be copied when you make that function call...
@rdlowrey around?
user895378
@orourkek what's up?
user652649
@ircmaxell i'm not doing that, i'm doing $a=&$b;
@rdlowrey Two things: Artax says it requires php 5.3+, but @LeviMorrison changed Ardent to require 5.4.1+
user652649
18:26
i'm worring about passing a huge array across lot of functions... so i thought passing it by reference would have improved performances
user652649
is that right?
second, any idea why composer (when installing Artax as a dependency) is looking for morrisonlevi/spl at the old location? (phpdatastructures, not Ardent)
And thirdly, Artax will be of great use to me in the very near future, so thanks in advance :]
user895378
@ourourkek All your problems will be solved if, instead of using composer, you just do this: git clone --recursive git://github.com/rdlowrey/Artax.git
@wes I know
@wes No, it won't
don't use references. Let PHP handle it for you
@rdlowrey That's my last resort, but all my other dependencies come through composer :/
user895378
18:29
@ourourkek I've been doing heavy development on a related project that will significantly improve the Artax code, which will continue to require a minimum of 5.3. As for the composer stuff, I'll try to fix that tonight. I've just been on another planet recently and have been extraordinarily busy.
user652649
function bla(Array &$a) so you are saying that this also produces a copy of the array?
@rdlowrey No worries whatsoever. I'll probably end up just cloning the repo, but it might get messy because it'll be inside an SVN repo :p
hecne why I wanted to use composer for everything
user895378
I get it.
@wes Why are you passing it around much?
18:32
I use only to modify an array... foreach($array as $key => &$value){}
@rdlowrey Interestingly enough, I just removed artax, added morrisonlevi/spl, and composer found it (at /Ardet) no problem
user652649
:P you are saying "it can" but function bla(Array $a) "it will certainly" create a copy
@wes no, it won't
@wes Again, why are you passing big arrays around?
PHP uses copy-on-write, meaning PHP won't duplicate anything unless it must
and creating a reference is one of those must situations (if refcount > 1)
user895378
18:34
@orourkek Oh cool. Glad it magically worked out. I "support" composer because people seem to like it. I avoid it, personally.
user652649
ok ircmaxell... thats a new feature right? i heard something about "string never will be copied unless it is modified"
usually it works great
user652649
@webarto i'm chaining function calls
@wes no, it's not new. It's been around since Zend Engine 1 (PHP 4.0)
user652649
of an existing code
18:35
night guys
@NullPointer Night
@rdlowrey But if anyone else has this issue, adding morrisonlevi/spl as a dependency before Artax in composer.json solves it, and lets Artax install
user652649
what i'm going to do is wrapping that array inside an object, and pass the object
user652649
night @NullPointer
@wes You mean methods? Why not protected $array; and $this->array ?
user652649
18:37
yes thats what i'm going to do
user895378
@orourkek Thanks for the heads up!
@orourkek 5.4.11+ to be precise.
well I run 5.3.x, so some hacking might be in order :]
@orourkek Remove callable type-hints, change array syntax.
That's it.
You can look through recent commits to see where to change things.
Yeah these diffs will be quite helpful
18:49
@orourkek the morrisonlevi/spl package no longer exists, right?
It should be morrisonlevi/ardent now.
@igorw It does
I left the git repo up for legacy for a while.
@LeviMorrison If I add it as a direct dependency in composer, it works fine
I can't find it on packagist
18:49
but not as a sub-dependency of Artax
@orourkek Artax 'requires' dev version but doesn't need to, I think.
It can safely use 0.5.0 which is 5.3 compat.
Actually, it requires >=0.1.0
artax requires >=0.1, but my direct dependency requires dev-master
But it's listed as spl
change it to ardent.
that's what I'm doing - just have to tread lightly when globally updating packages
@rdlowrey looking at your streams branch in ardent, belongs in a separate package imo but looks interesting. :)
18:53
Although using the php-datastructures repo would solve my php5.4 problem...
There haven't been any bug fixes since the changeover that I can remember.
All API changes and such.
@rdlowrey if it can be made to work well with async I might be interested in adopting it
most of the concepts seem identical with what I currently have, but using a cleaner API
@LeviMorrison I'm gong to use the old version for now (mainly for php5.3 support), but update everything to be not so 'hacky' at some point soon...
@igorw We're not quite sure what to do with the streams API just yet.
@orourkek Know that Artax will see some heavy updates soon. It may even remove the dependency on my library, we'll see.
'soon' meaning in the next several months.
@LeviMorrison I'm not saying I want to use it "right nao" but considering there seems to be common ground between the APIs, it may make sense to join forces.
19:00
@LeviMorrison good to know, but its current state will be quite useful to me for now
I'm really just thinking out loud to be honest ;-)
@igorw Maybe. Link to your project?
@igorw Unrelated question: do you guys see better performance with libev or libevent?
@LeviMorrison yes, check out section 9 on the ratchet autobahn tests: socketo.me/web/reports/ab
the last 3 columns show the results for libevent, libev and stream_select
user895378
19:09
@igorw Oh thanks. Yeah I haven't worked on it for awhile because I've been busy. I think simple OO stream access is something that's sorely missing in PHP. I can't stand the procedural c-style stream wrappers and their propensity to trigger errors left and right.
@igorw I don't mean the lib by itself, I mean using the PHP API on a real project. Have any of those kinds of tests?
user895378
And using iterators is just a simple concept that everyone can understand. It makes a lot of sense for streams.
@igorw if I read that right, all three are basically the same...?
meaning there are cases where all 3 take the lead
@ircmaxell from re-checking them right now, this seems to be the case. past runs showed stronger differences. investigating ;-)
sure...
user895378
19:14
My experience has been that stream_select is more or less equivalent to the others in terms of being a bottleneck at low levels of concurrency. It's under load where stream_select shows its cracks.
wow finally home. Evening all
user895378
Ceteris paribus, of course.
@rdlowrey same. libev seems to have some problems at load, but it's likely an error in the php extension or the event loop integration.
Lets say I have long list of <li>'s. That I want to flip over ( make last element first and so on ). Is there any fast way to do it? I can use even excel, no need to add any jQuery. It will be just one time aid
19:18
@rdlowrey true but libevent depends on interupts, no?
I am talking about pure HTML
@ircmaxell if you look closely, libevent is about 200ms faster at the higher load tests
faster than stream_select, that is
really?
user895378
@ircmaxell I have no idea how it works under the hood :) I just know that removing all extraneous function calls I get roughly the same results slotting libevent in vs. stream_select.
@Trouble Is it accessible by an URL?
19:20
@igorw Which version of libevent?
higher load in terms of a single thread? or in terms of high parellelism?
user895378
I mean load in terms of the number of open file descriptors in a single process event loop being "watched."
@ircmaxell single thread
yes
ah, ok
@PeeHaa it is now. pro-land.pl/bb
19:22
1 min ago, by PeeHaa
@Trouble Is it accessible by an URL?
libevent is more performant once you're polling many file descriptors, afaik it (epoll/kqueue) does some gambling on which ones are non-active, and polls them less frequently.
interesting
user895378
I was really surprised/impressed to see that if you don't need to handle simultaneous IO for more than a couple hundred file descriptors the native stream_select solution holds up really well.
@PeeHaa here, accidently edited last entry. pro-land.pl/bb
@Trouble There are 30ish options... What is keeping you from moving them manually :P
19:26
@rdlowrey regarding the ardent streams API, have you thought about pause/resume and making sure fast producers don't kill sink buffers?
I got 30 of thoes to do
@PeeHaa thats 900 :(
hey, another question about decoupling
You could write a PHP script which gets and reverses the domnodes
With for example domdocument
in contrellers you have views
that you can instantiate
how can I decouple them
@PeeHaa true, thanks :) gonna do that
19:29
?
I mean I don't know beforehand if the user will use the View class at all or not
user895378
@igorw I have, but it's been a couple of months since I've been actively engaged in working on that and at that point I had basically only gotten the "interface" down on paper. I tend to agree that the functionality belongs in a separate repo. If you want to hijack it and start fiddling with it feel free because I just don't have any extra time to work on it right now.
user895378
Having seen your upstanding behavior to this point I feel pretty good about your ability to acknowledge the contributions of others when appropriate :)
the only idea i have is passing a factory object
that will have a get method that returns a view
19:33
controllers should not be initializing the view
controller is supposed to be responsible only for changing the state of the other part of MVC triad based on user input
basically , the view is a dependency of a controller
what i mean is let's say i have regular views
View class
and haml views that extend View (Haml class)
i wanted the user to call 'new Haml()' etc
how would i abstract this without knowing beforehand which voew he would use
?
let the user inject haml into view himself?
emm ... HAML is a markup standard
what you are talking about here are templates
ill explain tomorrow
have to run
@Dracony acquiring data from model layer and distributing it through-out various templates is what view does in MVC
that's one of the ways how view can produce a response
and you HAML class i just a different variation on Template class
.. at least that's my interpretation of views in MVC, when adapted for web
@rdlowrey I've created a ticket for now. This is mostly nice-to-have at this point. But I do want to work on it at some point. Or maybe someone else picks it up.
user895378
19:43
@igorw Cool.
you have to respect @tereško and his unrelenting willingness to explain proper MVC architecture...
something like that
or should I say... "willingness"
I hate it when people keep "forgetting" their curly braces :(
19:54
YES, IT MAKES ME WANT TO THROW THINGS
today's find in the codebase, that i have to maintain/work on:
if($action == "BACK")
include ADMIN_DIR . "modules/action.php";
include ADMIN_DIR . "modules/menu.php";

// with this exact indentation
someone had made following edit to it, in previous commit :
if($action == "BACK")
// include ADMIN_DIR . "modules/action.php";
include ADMIN_DIR . "modules/menu.php";
What is it that people just don't see the problems with it :(
.. i was about a breath away from finding a proper item for braining someone
/** This is not security through obscurity, it is merely an obfuscation */
$token = hash('sha1', implode(PHP_EOL, $feedbackData));
And I feel bad about doing this... I should feel proud :P
user895378
str_rot13_all_the_things!.jpg
Blowfish + Base64 all of the GET :P
20:07
@webarto what are you trying to do?
i suspect that he want's to make me cry
i find the base64 thing upsetting .. i look at base64 encoded serialized arrays in $_REQUEST['PATH'] for 8 hours per day
@webarto signing the request?
Maybe... I'm sending "feedback" link via email, there is no auth whatsoever, except that these 4 params should match, if you change anything in the URL, it is likely it will mismatch. Even if it's tampered, it's not a problem (important).
@ircmaxell I don't know if that is the word, but probably.
20:11
don't hash, sign
so you're almost there
$token = hash_hmac('sha512', $data, $secretKey)
@ircmaxell , actually you could make a video on the subject
where key is secret that you never leave your server, and $data is your imploded data
@tereško yeah... Been thinking about it
@ircmaxell Thank you, that is indeed better solution.
British humor @DaveRandom :P
@tereško Yeah +1 for sure.
30
Q: What is with people who answer questions that are known to be dupes?

Popular DemandWhen a dupe is posted, someone usually posts a comment to that effect within minutes. That comment usually gets at least a couple of upvotes while the question is still on the front page. If it's a common dupe, you might see three or four such comments show up at once, all upvoted. Even with t...

20:38
Hi all, long time. Stupid question.. is there a more more-precise name for the separator used in date formats? i.e. 01/31/2013 vs 01-31-2013
@MikeB Date separator :P I don't think there is, that is Date format, "date separator" can be anything.
> / (slash) - (dash) . (period) , (comma) (blank)
Hey folks. I'm looking at developing a RESTful API in a LAMP setting. Are frameworks like Yii, Zend, or CodeIgniter suited to this task at all? Or are they really just for website-like applications?
@RyanKinal I'm using Zend Json Server... works OK, not great...
@webarto perfect, citations :)
@MikeB [citation needed]
20:53
@webarto Any more detail on that? Maybe some pros and cons?
@RyanKinal Not quite sure to be honest, it does job for me, but it's not complicated (my requirements), depends what you want I guess.
Sounds like similar requirements to yours. Simple, easy to develop with, gets the job done.
I'll look into it :-)
oh .. you are a c# developer .. that explains it
@RyanKinal , it might come as a surprise to you, but you do not need a framework to make a restful application
Oh, I know. And I could write it myself, but (1) I'm interested in learning a PHP framework and (2) the ORM in most frameworks will abstract CRUD better than I can.
Maybe
21:00
Perhaps add "(without significant effort)" to that sentence.
21:39
Okay guys, I have the most off-topic question ever to grace PHP Chat: Does anyone know anyone that works at McAfee?
What's wrong with this query?
no, but i might know someone at 3rd degree of separation
$stmt = $conn->prepare('UPDATE teams SET wins=:wins, loss=:loss, pct=:pct WHERE id=:id');
Fatal error: Call to a member function prepare() on a non-object
@Charles Have you found something interesting? :)
@DemCodeLines , $conn is not a PDO object instance
21:45
@tereško Look for that sentence in the past few days
@tereško Why are you talking to tiny avatar people :P
i was curious ..
lol
i have a problem ...
21:48
i know that writing :
$foo = [
           'foo' => 1,
           'bar' => 2,
       ];
Anonymous
evening
is recommended
but i prefer writing :
$foo = [ 'foo' => 1,
         'bar' => 2 ];
basically , my personal preferences are in conflict with practices that i try to uphold
I don't mean to be rude, but do us "tiny avatar people" have no value here?
@webarto No, just trying to get ahold of someone's manager. Had a telemarketer send an email to half my coworkers badmouthing me, and I am not going to allow such a thing to stand.
@DemCodeLines You have previously been identified as a help vampire. For example, the error you provided has dozens if not hundreds of dupes that you would have found with the most basic of effort.
@DemCodeLines Read about variable scoping in PHP first ask questions later
21:55
@Charles If you are telling me that I don't give any effort in the code, then I would like to say that's not true at all. Sure I make mistakes, but I don't do them purposely. I am no expert, in fact I am still in the beginner stages, and I was very comfortable with mysql_* until people told me that I should be using PDO.
Hence, I usually have problems with PDO.
@DemCodeLines ... you didn't even look up the error message.
</discussion>
afk
@Charles I did. I have done it many times.
Some of the errors that I ask here about today, I have had them for the past couple of weeks and been trying to look up.
when there is no answer, or if I can't find, that's when I ask for help.
The problem is basic understanding of the language and not some API
@Charles , just add him to the ignore list, like everyone else
Anonymous
@DemCodeLines the people who apply less value to others are the one's with little or no value. don't worry about them.
21:57
you can still view posts from ignored users if you click to view the transcript .. in case you get bored or curious
@PHPNooB Thanks for a positive message :)

« first day (839 days earlier)      last day (4335 days later) »