« first day (634 days earlier)      last day (4300 days later) » 

4:00 PM
At this point I wouldn't be suprised if someone installed php themselves but had never seen the manual pages.
 
php manual is always my first stop, if i dont understand it. i resort to googles, if that doesn't pan out i goto SO Chat, and then SO.
 
derpy doo, I can install this without knowing a thing about it, flips lips while making crazy sounds
 
@rdlowrey nice
 
@Event_Horizon How much of the manual would you say you've actually read? If I had to estimate (given that I know how big it is), I'd probably say I've actually seen 10-15% of it
 
just because you haven't read it, doesn't mean that you don't know it exists and that you don't reference it when in need.
 
4:01 PM
@Leigh Its not about how much you have read, its about making the attempt to find what you need using it first, then moving to other mediums.
 
^-- x2
 
Its about basic troubleshooting...
 
Wasn't really my point, I was just curious
 
user895378
I seriously doubt if I've even seen 10-15% ... the manual is enormous
 
I consult the manual pretty much daily, and I think I probably haven't really scratched the surface
 
4:02 PM
@Leigh I think I have read most of the important stuff in it by now. Not in the least because of PHP's great argument sequence
 
Oh, in that case, I have read about 1/4 of the Language Reference section, and then random bits here and there related to projects I had to do.
 
user895378
@Leigh same. I live in the manual and there are deep dark corners I'm sure I'll never see or know exist.
 
I usually revisit same pages...
 
jesus i hate IE. this site we have at work ONLY supports ie7. Can't use chrome, cant use ie8 or ie9. HAS to be IE7
 
Shame I clear my browser cache fairly regularly, and the links on the quickref page don't change colour
 
4:04 PM
@rdlowrey That may just be a good thing
 
user895378
@PeeHaa wow, suddenly your efforts for a new tutorial seem much more urgent.
 
Variables from external sources?
 
@Leigh :P
@Event_Horizon damn
> The magic_quotes_gpc configuration directive affects Get, Post and Cookie values. If turned on, value (It's "PHP!") will automagically become (It\'s \"PHP!\"). Escaping is needed for DB insertion. See also addslashes(), stripslashes() and magic_quotes_sybase.
@rdlowrey If we could only prevent 10% of stupid newbie mistakes the PHP world would be sooo much better
 
user895378
4:07 PM
I've been meaning to sit down and help get the Reflection section documented but I haven't had any time to do so ... sadly most of it looks like this:
 
@PeeHaa Didn't know they were called that
 
user895378
 
@leigh what the f?
 
@Leigh Thanks forgot about that one. Added to the list
 
hey fellas, long time no speak
 
4:08 PM
@AndyPerlitch hiya! How's life?
 
user895378
@AndyPerlitch too late, chat privileges revoked.
 
lol
life couldnt be better
hope the same goes for all yall
 
It always can be better
:-)
 
you got that right
aright i got a doozy for you guys
 
4:10 PM
@Leigh feel free to add on those topics with the online editor or pass me the changes you want to see
 
maybe not a doozy
 
I like it doozy. Shoot
 
user895378
I'm really going to try to start submitting one documentation fix per day to edit.php.net
 
@rdlowrey Great. Tell me you're changes so I can commit them
 
so i have two mysql_fetch_assoc result arrays from two queries, each with an sql aggregate function
 
4:12 PM
I wish I could downvote chat
 
user895378
@PeeHaa Sure thing.
 
Please, don't use mysql_* functions to write new code. They are no longer maintained and the community has begun deprecation process. See the red box? Instead you should learn about prepared statements and use either PDO or MySQLi. If you can't decide which, this article will help you. If you pick PDO, here is good tutorial.
11
 
mysql_* YOU SAY!
 
user895378
@AndyPerlitch lol you have been away for a while.
 
4:12 PM
@AndyPerlitch disregard them, continue ... doozy you've said
 
k well im not REALLY using mysql_fetch_assoc
 
@AndyPerlitch What's the problem?
 
ANYWAY
 
ok we'll let you off then
 
aright i have two arrays:
array( array('user_id','field1','aggr_result1'),array('user_id','field1','aggr_result1'‌​))
array( array('user_id','field2','aggr_result2'),)
i want to combine them, but it doesnt seem like i can use array_merge or array_combine
i could be wrong though
 
4:13 PM
why can't you
i'm just going to opt out now
i've got .... "work" to do.
 
gah... im not makin much sense
my bad errrbody
// word count
$word_count_query = "SELECT `translators`.`id` AS `translator_id`,`username`,`enabled`,SUM(`word_count`) AS `words_translated` FROM `translator_items` LEFT JOIN `translators` ON `translator_items`.`translator_id` = `translators`.`id` GROUP BY `translator_id` ";

// language list
$langs_query = "SELECT `translators`.`id` AS `translator_id`,GROUP_CONCAT(`lang_name_en` SEPARATOR ', ') AS `languages` FROM `translator_langs` LEFT JOIN `translators` ON `translators`.`id` = `translator_langs`.`translator_id` LEFT JOIN `dynamic_text_langs` ON `lang_abbr` = `abbr` GROUP BY `translator_
ok those are the two queries i want to combine
 
jesus use code block
 
I receive binary data via cURL (a word doc) and need to display it to the user (open/save dialog). Most functions I saw talk about reading a file stored somewhere. Is there a way I can directly take the binary data (with its headers) and just create the open/save dialog?
 
@Mike kewl
 
@PeeHaa ??
 
4:19 PM
@AndyPerlitch what do you need ultimately?
 
@Mike Didn't knew pastebin v1.1
 
different site entirely. but i typically use gist.. hastebin is purdier
 
@Leigh one array where each value is an array that corresponds to one translator
meaning that both the words_translated aggregate field and languages aggregate field are values in the same array
 
mtk
@Mike Thanks for the hastebin link, that is really a handy feature. Got to know about it today.
 
based on the translator id?
 
4:22 PM
yes
 
Is it impractical to merge the queries?
 
gist.github.com is way better than hastebin as it allows versioning and forking
 
rather than merge the arrays
 
i dont think its possible
 
i didnt know chrome dev tools had a color picker
 
4:24 PM
@Mike Chrome dev tools rockorz
 
i have so many bookmarks, i've forgotten about them
i really need to clean shit out, i have bookmarks from 2001
 
mtk
@AndyPerlitch please let me know the exact problem. Are you able to get the two results in php? I mean is your question in reference to firing mulitple queries? or you are searching for merging the data? or are you searching for combining the 2 sql queries into one?
@mike same here. I browse a lot and often land up bookmarking the same page, so sometimes I wonder what the use of bookmarking !!! I just make a huge list of bookmarks which I never use...
 
How would PHP know when to do what? Generally a bad idea anyway it has code smell IMHO. — PeeHaa 51 secs ago
 
@mtk let me try and illustrate my problem a little better, give me a moment
 
mtk
cool. at ease. back in 10 mins.
 
4:29 PM
@AndyPerlitch post an example of the resulting array
 
@Mike wait, where?
 
to the left of the #ffffff
is the color icon, click it
when you're viewing an element
supports transparency too, and will convert the #FFFFFF to an rgba
 
holy awesome I just made PHP chat background red
 
lol
 
BLOOD FOR THE BLOOD GOD, SKULLS FOR THE SKULL THRONE
 
4:31 PM
its not permenant, as soon as you reload it changes back.
 
still that is nice, didn't know it had that
 
see:
 
@AndyPerlitch Had to guess a bit, but why can't you do something like: hastebin.com/lumaqiroxo.sql
 
you can edit the entire DOM through there, and in the console you can exec js.
 
I use chrome console extensively
 
4:33 PM
@EventHorizon there are a ton of new features since that article, google for it. Also an extension for chrome that will log php debugs to console of chrome.
 
@NikiC I summon thee
 
@Mike nice
 
im going to bitch at Ellis Labs, they need to make CodeIgniter's profiler ajax friendly.
im tired of having to disable the profiler for methods that are for ajax
oo i wonder if i can write a hook.
 
@Leigh because it counts rows multiple times since there is more than one join
shblam
 
Hi everyone
 
4:42 PM
@AndyPerlitch have you solved problem? (wasn't looking)
 
nope, was on break
i think array_merge or array_combine MAY work
ah screw it, i'll just loop through
 
@AndyPerlitch why don't you post the expected array?
it would make things much easier for us
 
sry, must have overlooked it
 
no worries
 
4:55 PM
@PeeHaa Here I am
 
[languages] => english, french means english TO french and every direction is stored like that as a single value?
ah... no, I guess I get it... you just want to list all languages the person does and the total sum of translations in all those languages, right?? @AndyPerlitch
 
no that field is actually created by a GROUP_CONCAT() fn, so there is an intersection table where each row is a link between a translator and a language
yes
sorry for the confusion, im having trouble putting this one in words
me no talk good
 
I want unit tests for my whole code base so badly.
I fix a bug and just break something else.
My coverage is growing, but it's so slow.
 
@LeviMorrison dont we all...
 
@AndyPerlitch and have you tried with subqueries or do you want to avoid them?
 
5:00 PM
im not exactly sure what you mean by subquery
like multiple queries? yes i have given up on trying to make one big query
basically the first two arrays in that hastebin page i put up are results from two separate queries
and i just want to combine the two result arrays based on the translator_id field
using php, not mysql
 
user895378
@LeviMorrison The good thing is that it's a vanishing problem. As you move forward you have tests for all your new work so eventually you don't ever have to worry about it anymore :)
 
@rdlowrey It's vanishing so slowly. I wish I had another developer sometimes.
 
user895378
@LeviMorrison lol join the club on that one.
 
Then I think to myself, "Do you really want another developer to come in here and **** up all your hard work? No. I don't. Be quiet and deal with the code."
 
@LeviMorrison lol
@rdlowrey how's artax goin anyway
 
user895378
5:03 PM
Yeah, extra hands are only helpful if they really know what they're doing.
 
still on it? or no?
 
@AndyPerlitch both is possible... it's possible to write it in one query with subqueries or with PHP
have you tried array_map('array_merge', $array1, $array2) ? well not exactly like that
 
user895378
@AndyPerlitch It's pretty stable but I need to overhaul the error handling work. It's not exciting, but the web application @LeviMorrison and I have been formulating on top of it is.
 
@markustharkun let me look into array_map
@rdlowrey cool. still up to date on github? i'll have to check it out
 
user895378
@AndyPerlitch Yeah, you can find both projects on my github.
 
5:06 PM
@rdlowrey sweet i'll take a look when i can
@markustharkun that totally worked
but im curious about that could be done with just one query
since it is using two separate aggregate function-generated fields
and they are aggregating data from two different tables
 
that's why you'd need subqueries
but I think the php way may be faster and easier to maintain
because the query could become a little monster
 
totally
im readin up on subqueries now
but i think you may be right
 
@rdlowrey I'm holding a conversation with a friend on PHP: The Good Parts.
 
@anyone: just in case you don't know this yet: fortawesome.github.com/Font-Awesome
 
user895378
@LeviMorrison Are you referring to the actual book, the actual good parts of PHP, or the funny comment in the star bar?
 
5:12 PM
@rdlowrey Sidebar.
Page 42 is particularly enlightening.
Don't you think?
 
user895378
lol
 
user895378
I had to re-open it and scroll down to 42 just to make sure I hadn't missed anything.
 
@rdlowrey lol
 
sry pressed enter
@markustharkun thanks for the link, It cover everything that I was looking for a next project.
covers*
 
user895378
5:15 PM
I really feel like PHP has a lot of good parts (but an inordinate share of bad parts). I think the negative public perceptions arise from developers using the bad parts. Meanwhile, developers who know how to avoid the bad parts can write really useful, elegant applications.
 
user895378
It's a shame the authors of the actual PHP: The Good Parts book did such a poor job.
 
user895378
It's nothing like Crockford's javascript version in that it doesn't tell you anything about how you should and shouldn't use PHP. It just says, "here's how to do stuff."
 
@rdlowrey You mean its Amazon description is inaccurate?
> Get past all the hype about PHP and dig into the real power of this language. This book explores the most useful features of PHP and how they can speed up the web development process, and explains why the most commonly used PHP elements are often misused or misapplied.
 
user895378
@LeviMorrison I didn't find it did anything of the sort.
 
user895378
5:19 PM
Or if it did, it was so unrecognizable compared to the javacript good parts as to not be nearly as helpful.
 
@PHPUnitMasters How can I do a better test for this:
> $this->assertTrue(filter_var($response->getEntityId(), FILTER_VALIDATE_INT) !== FALSE);
Additionally, do assertTrue and assertFalse use weak or strong checks?
@rdlowrey Do you know?
 
@AndyPerlitch ideone.com/064J9
build $arrays like this $arrays = array($first, $second, ...);
for($i = 0; $i < count($arrays[0]); $i++)
                for($n = 0; $n < count($arrays); $n++)
                    $t[$i] = array_merge( (array) $t[$i], $arrays[$n][$i]);
 
user895378
@LeviMorrison I'm pretty sure assertTrue and assertFalse are strong checks
 
Then does anyone know how to write a better test than: $this->assertTrue(filter_var($response->getEntityId(), FILTER_VALIDATE_INT));?
Acually, that won't work.
It has to be !== false
Since it returns an integer if it is an integer.
Dunno who chose that logic . . .
 
5:31 PM
PHP is full of it :P
 
user895378
@LeviMorrison I would do this instead for readability. I've recently been enlightened as to the importance of making your tests as clear and readable as your source code:
 
user895378
public function testSomething() {
    $isInt = filter_var($response->getEntityId(), FILTER_VALIDATE_INT) !== FALSE;
    $this->assertTrue($isInt);
}
 
@webarto nicely done. i think this is similar to @mark
@markustharkun's array_map solution
 
yup, nothing doozy there :)
 
ill put up a code sample of it in a sec
 
5:38 PM
why haven't I seen teresko anywhere these days?
 
Hello again
 
user895378
@markustharkun Lately I've seen him on in what is the evenings for me (and the very late night/early morning for him) and not so much during this time ...
 
@PeeHaa :-P
@NikiC I'd prefer not to. If you really want to, fine. But I think keeping discussion on-list has a lot of merrit. But if you want, go for it
 
@AndyPerlitch much better, I just like to code myself what I don't fully understand, so I can understand how certain function works...
 
5:48 PM
I've got this string "2012-07-11 16:15:00" and Europe/Berlin as the default timezone. But why does strtotime() return Wed, 11 Jul 2012 16:15:00 +0200 ?
 
mtk
@AndyPerlitch glad you got the solution. was looking for it. congrats!
 
user895378
@user897029 It can't possibly return what you've said. strtotime returns an integer.
 
@rdlowrey You're right, of course. I forgot "date(DateTime::RFC2822, ...)" to add here
 
mtk
@user897029 Same question as that of rdlowrey. It returns a integer.
 
user895378
@user897029 Well, as per the RFC2822 specification (which you've told your date function to ouput), the resulting string should have the timezone offset appended.
 
5:53 PM
Noob questions: Is there any reason to docblock if you don't use an IDE? When should I unit test?
 
user895378
@user897029 Also, date(DateTime::RFC2822) is the same as date('r')
 
@rdlowrey Shouldn't it output Wed, 11 Jul 2012 16:15:00 +0100? Europe/Berlin is GMT+1 (or do I have a logic error?)
 
user895378
@user897029 Oh, sorry, I have no idea what the timezone offset is in that location. I seriously doubt the date function is returning an invalid offset.
 
user895378
@user897029 If there's a discrepancy, it's likely that the default timezone isn't defined how you think it is.
 
@user897029 in summer berlin should be GMT+2
 
mtk
5:57 PM
@rdlowrey and @user897029 after you solve this query, please let me know whats behind this date(DateTime::RFC2822). As I am not aware and also I am new to php. I ran this in php interactive console and saw the output, but are there more such predefined string like 'RFC2822'. Please clear my doubt. Thanks
 
user895378
@mtk DateTime::RFC2822 is simply a constant of PHP's built-in DateTime class.
 
@markustharkun Ah yes! Actually, I don't (want to)care about timezones in my simple application here. So can I remove all offsets in any way?
Just set the default timezone to UTC and it seems to work....
 
mtk
@user897029 please let me know, how you change the default time-zone? Are you changing the time-zone of your machine or is it something php specific? Thanks
 
@Event_Horizon Yes, you can generate documentation, besides your code becomes more legible for other users
 
mtk
@user897029 and @rdlowrey Thanks for the clarification on DateTime constants.
 
have you guys heard of a mysql db crapping out after it receives too many queries
like it goes into a safe_mode and doesnt allow any more
single connection
 
mtk
@user897029 cool. Thanks again.
I should go through the complete php manual ;)
 
@FabioCosta Should I unit test everything or only certain things, at certain times?
 
I hate it
I hate that fucking anti-PHP sentiment
 
6:03 PM
@Mike There could be a query limit for a specific user
 
Comforting that at least the comments are reasonable
 
@webarto definitely i work the exact same way
 
@mtk couldnt have done it without ya!
 
user895378
@NikiC People are just stupid, ignorant, or both. I wouldn't worry about it :)
 
mtk
6:07 PM
@all bye. good night. got to go.
 
> Getters and setters make your program object oriented in the same way that brown food coloring makes a food bacon.
 
thx
 
@rdlowrey people always have troubles with statistics
 
friends working on a script and he's testing it and let it run for 4 hrs in a loop and it kicked out after like 2 hours.
wouldn't accept anything
 
user895378
@Event_Horizon More and more I find docblock style documentation a source of errors in code. Code changes. A lot. And every time it does you introduce a not-insignificant possibility that your docblocks are liars. The better solution is to write code as clearly and readably as possible so that comments are moot. That said, in the absence of scalar typehints, documentation like @param string $myVar can be helpful as well as @return declarations.
 
user895378
6:10 PM
For public APIs you should probably fully docblock everything that's public, though.
 
user895378
Your code should read like a story. It should be utterly obvious what's going on at all times.
 
@rdlowrey is that a problem, if your IDE tells you when your docblock doesn't match your code?
 
@mtk take it easy
 
user895378
@markustharkun My feelings are:
 
user895378
API doc generators? SOURCE CODE: One doc to rule them all, one doc to find them. One doc to bring them all, and in the debugging bind them.
 
user895378
6:12 PM
Docblocks create extra work that's almost entirely unnecessary when you've written quality code that doesn't require comments.
 
user895378
Not all comments are evil. Some are warranted and desirable.
 
@Event_Horizon Sorry for the late reply. Ideally you should test everything but if you don't have the time just test the crucial parts of your code and retest every time you make a change on them
 
@rdlowrey on the other hand, docblocks can enhance IDE code assist a lot
I fully agree with 'Your code should read like prose'
 
I guess the real question is, should I be unit testing every project I do, or only on medium to large projects?
 
user895378
@markustharkun Well, I pretty much work entirely in text-editors as opposed to full-blown IDEs, so I can't really speak to your arguments there. You're probably right for developing in the IDE world.
 
user895378
6:14 PM
@Event_Horizon You should be unit testing all public interface code all the time. The size of the project should have no bearing on it :)
 
@Event_Horizon i think that you should unit test every project. It will save a lot of time in debugging
 
I haven't had a project where I have needed them yet, so I figured while I have downtime at work (lots of that atm) I should be learning how to unit test.
 
user895378
 
@rdlowrey ok, different paradigma... less docblocking in your case seems to make sense... I'd never want to work without my beloved IDE but I understand the text editor way to a certain extent
 
user895378
> It makes your code less clean and does not give you any more control. As long as you control the source for all your callers you should happily engage in as much static binding as possible (ie, you should make the program as short as possible).
 
user895378
6:17 PM
man, reddit php is just a circus of buffoonery hijinks, skullduggery and tomfoolery
 
Use Notepad++ to do ALL THE THINGS!
 
@Event_Horizon like washing dishes, etc.?
 
Well if your dishwasher is one of the newer ones and you connect it via usb...
just gotta solder some wires to the circuit board and wala, usb dishwasher
XD
 
:) I wash dishes by hand... so I'd need to kind of materialize notepad and use it as a towel or something
 
See thats when you get an engineering degree and build yourself a hand dish-washing robot.
 
6:27 PM
public function isValidEntity(RenewalEntity $entity) {
    return TRUE; // valid every time
}
Love my job.
 
CAM
How can I get my DB schema reviewed for performance / Design?
 
decided by fair dice roll
 
CAM
Simultaneous Q: anyone have experience building adservers?
 
I'm having an issue in Chrome/Safari with $.fancybox.showActivity(); showing during a form submission on the server, but not localhost.
 
6:29 PM
too ... much ... questions
 
I remember someone in here having something against singleton pattern, but I cant remember why, is there anything inherently wrong with using it?
 
@Event_Horizon Are you being serious?
 
Yes, I'm trying to advance my understanding of OOP, patterns and the like.
 
Those slides are by the Stack Overflow user known as @Gordon.
 
@LeviMorrison Like I said, I thought I had seen something in here about them.
 
6:34 PM
anyone in here have experience with fancybox, or should I be in another room?
 
@ircmaxell Going for it. Could you explain what that function is good for (in practice)?
 
@Waddler You should probably be in the JS room.
 
Levi Morrison use php on the site that I'm working on. I'm in there too...but no one has noticed my question or is just ignoring it.
@Levi Morrison
*we use
 
@EventHorizon it's like using @ :)
 
From the examples it doesn't seem too hard to avoid.
Maybe I should just ask you guys, what patterns should I learn to use (if any)?
 
6:50 PM
$registry = Zend_Registry::getInstance();
:)
 
I mean I see a lot of people on here using Factory pattern.
 
Factory is OK (imho)
 
0
A: PDO 2300 upon insert though no rows exist

webbanditIf your PRIMARY column name is 'PRIMARY' you can try: $compost = $dbh->prepare("INSERT INTO `table` (`PRIMARY`, `some`, `content`, `rows`, `and`, `boolean`) VALUES (PRIMARY, :binded, :param, :inputs, :blah, 0)") ; or just not to mention that field at all: $compost = $dbh->prepare("INS...

I'm going insane trying to fix this
Tried a new table so its def something in how the pdo is handled
 

« first day (634 days earlier)      last day (4300 days later) »