« first day (272 days earlier)      last day (4901 days later) » 
00:00 - 14:0014:00 - 22:00

14:14
can we cv stackoverflow.com/questions/6707315/… pls. OP didnt search and lots of duplicates.
14:24
wow that question gets asked a lot
people just dont understand namespaces
like folks trying to use the DOM extension without knowing what the DOM is
yeah
or the difference between XML and HTML
Can anyone help with this: stackoverflow.com/questions/6708533/… ?
@Gordon or worse, that HTML is not built on XML
14:38
@Neal try with ^ in it. see updated answer
@Gordon see my comment...
the way you have it now is completly wrong
This worked for me:
SELECT *
FROM `eodList`
WHERE datechanged>='2011-07-13' AND
symbolName REGEXP '^[A-F]'
GROUP BY symbolName
ORDER BY symbolName DESC
@Neal yeah. sorry. fixed. wasnt paying much attention. can remove the comments
@Gordon there u go
seems like regex and character class was the clue you only really needed
@Gordon lol ya. thanx ^_^
ddnt know mySQL did regex
14:42
@Neal welcome and thanks for pointing out the errors
@Gordon lol np
now i just gotta implement this into my code lol
Val
Val
15:10
hello
15:29
posted on July 15, 2011 by Horde news

I promised to look into generating a chart of the Horde login processes, and out came an activity diagram. I'm not perfectly happy with it yet, but it's being rendered automatically thanks to PlantUML and Graphwiz.

15:43
plantuml.sourceforge.net looks interesting
15:58
hey guys, where can I find geeky programming clothing?
geeky programming clothing! thinkgeek.com @polyhedron
@polyhedron thinkgeek.com has apparel and clothing among other fancy stuff
@polyhedron err, see my last message.
It seems to be a question with a universal answer.
chat will ping you as long as your name is spelled halfway uniquely, @poly ;) its just nicer with the reference arrow in front because it will gray the reference message
16:19
alternatives to thinkgeek.com ... now that would be the real question....
I wouldn't dare to ask
cv ring is weak today
Hello everyone
is there anyone here that can help me with a file-writeing issue?
16:35
@salathe yeah.. isnt the same with @ircmaxell and @edorian not around
did you set 777 ?
@GregAgnew see room description
@portforwardpodcast you should never ever set anything to 777
chmod 777 Gordon
*Gordon seen room description, here is the link if anyone cares to help! stackoverflow.com/questions/6710309/…
gordon what perms should i set my upload folders to then?
@gordon
16:39
@portforwardpodcast writable for the user executing the php script
@salathe adding params to filenames is getting "popular". Feature request stackoverflow.com/q/6710086/208809 :)
@GregAgnew hmm
can you paste the first 20 chars from the blob please
@gordon does this mean the user running apache?
@portforwardpodcast if your webserver is apache, yes
@GregAgnew answered
@Gordon I'm not sure what you are telling me to do.
@polyhedron now that you mention it :) i actually meant to point that to sdolgy.
17:00
Man, I should totally start a blog about php-internals. From the hullabaloo about the whole ext/mysql deprecation proposal, I could make a killing in AdWords...
@Charles well, a nice blog that summarizes what happend in internal would certainly be nice
@Gordon What, you mean there are reasons to do things other than money?
@Charles ah, you can do it for the adwords but i still would like to read it :)
@Gordon Don't you read internals itself?
@NikiC of course not.
17:10
Shockingly few people do.
I don't blame them, really. Half of the core team has their collective heads up their collective rear ends.
Oh noes we can not introduce new syntax, it will confuse people!
On the other hand, after hanging out on SO... yeah, new syntax will confuse people. But still.
a thread on internals has only two possible states: no answers at all or turned into OT.
@Gordon Good for you. It really is sometimes a pain to listen to what they say.
s/sometimes/mostly
i like this one. its not needed, but i like it: bugs.php.net/bug.php?id=10203
Yeah, it has potential.
@Gordon And that's one that's probably going to be declined ;)
I voted for it, but most are against it ;)
And I think that the people against it have a point. If many people on internals don't get what the syntax does without an explanation, most others probably won't either ;)
17:19
well, i usually use array access directly so i dont care much if it gets declined
@NikiC which is funny because it's completely obvious to me what it does
The problem is, as was kind of pointed out by accident in the bug, it might look at first glance like it's another way to say foreach($foo as $bar => $baz), when in reality it isn't
yep
It's obvious to me too
But others don't seem to get it ^^
17:37
@Charles so will you do it?
@Gordon Currently (once again) in the search for a sane Wordpress theme :p
@Charles let me know when I can start reading ;)
@Gordon Might be a day or two :p
all of you seem to have blogs...
@NikiC yeah, but i rarely write to it
17:45
I don't actually have one of my own, I just have set up a few for friends, relatives, etc.
17:57
where did that @GregAgnew guy go?
Comes in here, points to his question and then leaves although i gave him the answer
1
A: Error in Writing to Image file from PHP

GordonYour "Blob" is really a Data URI: data:[<MIME-type>][;charset=<encoding>][;base64],<data> Since you only want the decoded data part, you have to do file_put_contents( 'image.jpg', base64_decode( str_replace('data:image/jpeg;base64,', '', $blog) ) ); I...

just wondering:
could one have replaced the
base64_decode(
str_replace('data:image/jpeg;base64,', '', $blog)
)
part with a file_get_contents($blog) ?
interesting question
since stream wrappers include data://
try it :)
:P
$data = 'iVBORw0KGgoAAAANSUhEUgAAABwAAAASCAMAAAB/2U7WAAAABl'
       . 'BMVEUAAAD///+l2Z/dAAAASUlEQVR4XqWQUQoAIAxC2/0vXZDr'
       . 'EX4IJTRkb7lobNUStXsB0jIXIAMSsQnWlsV+wULF4Avk9fLq2r'
       . '8a5HSE35Q3eO2XP1A1wQkZSgETvDtKdQAAAABJRU5ErkJggg==';
is a base64 encoded png
The first example shows that it does work ;) And I just tried, it works without the // too: codepad.viper-7.com/s5TTvo
18:09
do you want to add it as an answer? otherwise I'll add it
@Gordon go ahead ;)
lol
hey
(8:11:21 PM) philip__: one great thing about phpdeveloper.org vs php planet is, is that chris studies the topic before posting and adds an insightful comment
(8:12:12 PM) nikic: chris is phpdeveloper.org or php planet?
(8:12:24 PM) philip__: php developer
(8:12:35 PM) nikic: oh, yeah, php developer really sucks
(8:12:43 PM) philip__: i think the opposite
(8:12:43 PM) nikic: very much bad content
(8:12:47 PM) nikic: interesting
(8:13:14 PM) Tyrael: hehe
(8:13:15 PM) nikic: in the SO php chat we recently removed it from the feeds due to all the bad content ;)
interesting how things look different from different perspectives ^^
yeah. lol
@Gordon thanks!
18:19
@ircmaxell that wasnt a compliment but a complaint about weakening my most powerful tool at SO ;P
Oh, now this is interesting
wait, you quoted me in here? heh
hi @philip :)
I think we should have an IRC bot that listens to #php.doc and creates an RSS feed from it so we can add it as feeds here ;) eavesdropping bot.
that's a terrible idea! :)
@Gordon Nope, people would get depressive in here ;)
18:21
This is the land of PHP. Depressive is the norm, as we have to deal with PHP.
is this a php support channel?
@philip not really a support channel i'd say but ppl certainly come here to ask questions, too.
More like a PHP support group. My name is Charles, and I am a PHP developer.
Nothing is wrong with PHP but most the time it is implemented poorly.
@philip nah, it's more a philosophical chat in here
18:23
Like Magento is a great example of how PHP should be done.
i see 5 people don't like ext/mysql :)
Jul 4 at 14:19, by salathe
PHP sucks.
that got starred by 13 people ;)
we have had lot's of enlightening lately ;)
just wanted to quote that too...
I've started learning Python
To be honest im probably going to move to Python
yeah
18:24
basically we came to the conclusion that php and everything related to php sucks, but we like that. it rules that php sucks :)
I wish I could get over python's whitespace. Sigh.
they sponsored my post to remove ext/mysql, co-sponsored by postgresql
:)
@Gordon :-P (I know)
php has issues, this is true
Anyone ever had a problem with validating PHP sessions over a network using dual band?
18:26
@Darren "Dual band"?
Two internet connections on our network
PHPUnit is giving me a problem. On one system, it doesn't count interfaces and empty classes as covered (even though they are used) and on another it does...
2 interfaces connected to our router
@Darren Meaning you have two external gateways with two distinct IP addresses?
might be a network issue
18:26
@philip so have the other languages :)
yeah Charles
and they keep switching
back and forth
@ircmaxell no idea. ping @edorian in IRC, but I'm not sure he's on.
@Darren It shouldn't be a problem unless you have something in your code that checks that the IP address of the current user matches an IP address in the session.
yeah, more curious than anything
18:27
Yeah @Charles its how a lot of sites work, especially Magento ones
IP addresses are not reliable and should not be relied upon (even for sessions)
@ircmaxell Yeah, it wouldn't surprise me if they (or ZF's session bits that they're surely using) have some IP sanity checking going on.
I wouldn't be surprised at all, but that doesn't mean that it's a good idea...
I dunno, I consider an IP switch mid session to be insane. A lot of places freak out when I turn on/off my proxy in Texas :p
I know one site that used IP addresses to assign admin functionality (or restrict against it at least). I was able to get admin :-P
18:30
@Charles I am using a tunnel to do work on the site.
so what made several of you decide to join the php doc team?
@ircmaxell I've never seen that handled correctly. Inevitably the person with the IP leaves the organization and the IP hangs around for years and years, untouched, until someone with a brain comes by and does an audit....
@Charles You've never been behind a NAT based round-robin across multiple connections...
@philip A severe case of bravery and/or masochism?
@philip The shiny new (memory eating, slow) editor, maybe :)
18:31
@ircmaxell This is very true, but I've had to support users behind such abominations, and I hated every moment of it.
@philip I got tired of complaining and decided to start fixing
5
bravery perhaps, also masochism not sure. the doc team tries to remain positive
@Charles Well, as long as you're not doing anything dumb like tieing the IP to the session, it should just work transparently
the php project has a PR problem, and a real problem of negativity, but hopefully it doesn't affect all parts
@philip And because I really don't like the fact that the French have much higher docs coverage than the Germans. That's really annoys me. So I try to make it better ;)
18:32
ha
@NikiC /me isn't going to comment on that...
lolz
the japanese used to be the only 100% translated manual
then the french created the online editor....
this chat interface is slick
is this all recorded? :)
bbl
18:34
Oct 15 '10 at 7:49, by pestaa
I hope we'll be able to exchange a couple of PHP-specific ideas here. :)
@philip yes. that's something that I don't like about the #php.doc IRC chat. It doesn't have history
it's informal and free from such things
greetings @ircmaxell
hoy hoy
going out now.. laters
18:50
Take care, Gordon
later
 
2 hours later…
20:46
Hello Everyone!
Greetings and salutations.
I have a silly question about mysql_real_escape_string()
I'm so sorry.
@Gaurish You shouldn't use the mysql_ extension anymore. use mysqli or PDO MySQL instead ;)
And what @NikiC said.
20:51
@NikiC Yeah, I read the announcement. But my hands are tied
AAaaiiiiieee, it wasn't an announcement, it was a freaking proposal!
I mean, it's fantastic, but it hasn't happened yet
I am modifying a existing script which uses mysql extenstion
@Charles He probably is talking not about the internals proposal, but about that blog post ;)
I saw it on hacker newshttp://news.ycombinator.com/item?id=2767560
"PHP to deprecate MySQL extension"
And just so you know: That blog post was written by somebody who used to troll the PHP mailing list and insult people there. The blog post contains lots of false information.
ah, okay
20:53
so is it going to be deprecated or not?
ycombinator's okay ;)
It's probably going to be deprecated unless the folks at MySQL/Oracle don't wanna.
From later replies to the thread, they don't seem to mind the idea.
They prefer mysqli to PDO though.
Anyway, what's your question, @Gaurish?
but I think Oracle doesnt have anything to say about PHP development?
@Charles That's the kind of false information I was talking about...
@k00pa If you read the php-internals thread, it's noted in there that they want to check with Oracle to make sure that they are fine with dropping support for the old extension.
20:55
@Charles kk, haven't read that, only the one mailing list post
Question: Are both of usage of mysql_real_escape_string() correct:
1) $foo = mysql_real_escape_string($_POST['foo']);
2) $query = sprintf("SELECT * FROM users WHERE user='%s' AND password='%s'",
mysql_real_escape_string($user),
mysql_real_escape_string($password));
@NikiC What do you mean?
@Gaurish Both of those are fine.
Though you really should be hashing and salting your passwords.
first one gives code that doesn't look messy imo
and yeah, do the salting, its not that hard
at least md5 the passwords
@k00pa Yeah, but the second "feels" more like a prepare/placeholder process, which implies the dev writing it isn't out of touch.
@Charles I mean: Don't go telling people that ext/mysql is soon to be deprecated and removed. We are just talking about docs. Removal of ext/mysql obviously will happen, but only years later.
20:58
@NikiC Indeed. Though "years" makes me sad.
its not necessary mysql_real_escape_string() function has to be used inside mysql_query(). We can use mysql_real_escape_string anywhere in php?
yes
@Gaurish You can use it anywhere as long as you've opened a connection already.
Cool!
If there's no connection, it can't talk to the server to fetch the right character set information.
21:01
so this functions depends upon mysql server. I didn't know that
Btw, I have a friend who insists on using mysql extension. I tried to make switch to PDO or mysqli but I says its hard to use. Any tricks which can make the process easier?
@Gaurish You might want to head back over to the proper manual page and review the Notes section, where the connection requirement is mentioned. You might have missed other information
@Gaurish What does he say is "hard" about it? Is he unfamiliar with object-oriented PHP?
1 sec, will explain with example
@Gaurish I personally use a light wrapper around PDO, which gives me a nicer syntax (nicer for me, others may think different): github.com/nikic/DB
That's a small 85 lines wrapper, but it saves me a good lot of typing ^^
checking...
@NikiC Looks good, what license this is under?
thinking of using it in my own projects
@Gaurish BSD. I should upload a license file later
21:14
hi, i have a question for the php gurus. have the following simple function:
    	function get_by_ids($ids){
		$this->db->where_in('id', $ids);
		$q = $this->db->get($this->table_name);
		return $q->result();
	}

If i accidentally  pass NULL as a parameter, it selects my whole DB. how can i make this error proof? do i check for NULL? do i check for numeric value? what's best practice?
@mgPePe What database layer are you using?
uhm, that question is one layer above my knowledge... i am using Codeigniter if that helps?
@mgPePe It's likely then that you're using CI's database layer then.
@Charles both are similar but PDO method was 2-3extra concepts. I guess that problem can be solved by using a wrapper class? gist.github.com/1085562
@Charles yes, for sure, i am using the database class as documented
21:16
and therefore, you should probably check their docs first to see whether or not null-to-get-everything is intended. If so, just adding a null check to your function should be enough.
@Gaurish You could solve it by using a wrapper, yes.
@NikiC Thanks, I am now following you on Github :)
but then if i pass anything besides an array with digits, it may select the whole DB again
@Gaurish Also, in that gist, you have a syntax error. Placeholders are automatically quoted. You'd need to put the percents into the string passed to bind/execute.
@Charles for example let's say that by mistake i pass a string instead of array of ID's.
@mgPePe So don't do that then! :) if(!count($ids)) return array(); is pretty much all the magic you need...
21:18
so this way, i have to check for all kinds of things it is not
@Charles ouuuu that looks like exactly what i need!
@mgPePe Now you're just trying to prevent yourself from doing something stupid in the future. Do you regularly do stupid stuff? There's only so many things you can do to prevent yourself from putting a bullet through your foot without it getting in the way and/or wasting your own time.
lemme go test it... :)
@Charles you have a good eye! on other hand, I really need to learn PDO properly.
@Gaurish It will be very worth your time doing so.
@Charles yes, unfortunately i am quite a beginner, and i often miscalculate stuff and get wrong results. like I would forget to deserialize and then pass a string rather than array to function and stuff like that
I am quite a noob
So i am trying to get error proof and get some good practices
21:21
@mgPePe No offense to your noobishness, but if you find yourself serializing stuff, you might be doing something wrong.
@Charles What's the best place to read about PDO? php manual? or some other resource which is recommended?
@Charles hmm really? how come?
@Gaurish The manual is a comprehensive reference, and I'd advise reading through it (while ignoring the comments) at least once or twice before going out and looking for tutorial material. I've rarely seen a PDO tutorial that wasn't either super-basic or delusional, unfortunately.
ohk. RTFM it is :P
@mgPePe Serialization tends to be abused as a way to store data long-term, like in a database. It happens that storing serialized data in a relational database is a really, really bad idea. You can't actually query against the data when it's serialized.
Serialized PHP crap in a relational database is my own personal hell.
21:26
@Charles hmm. Here's the case. I have a huge list of words. Some of them need to be connected to a few others at the same time. I have one column that says "ralated_to" and in it for each of the connected words I have serialized the ids of the others.
@mgPePe That's a one-to-many relationship.
You should be storing it as multiple rows.
i.e. CREATE TABLE foo( left INT, right INT, PRIMARY KEY(left, right)); INSERT INTO foo(left, right) VALUES(1, 2), (1, 3), (1, 4); SELECT right FROM foo WHERE left = 1;
(Example data and column types of course)
@Charles ok, i kinda get it. but then here is the question: let's say i want to check if 4 is connected to anything?
in this case only 1's are in the left column
CREATE INDEX foo_right ON foo(right); SELECT * FROM foo WHERE left = ? OR right = ?
Things get sticky when you need recursion.
"Give me all of the things connected to all of the things connected to 4."
Postgres and MSSQL have thing called Common Table Expressions, aka the WITH clause that makes recursion easy. I presume you're using MySQL?
(In which case you're out of luck unless you want to totally redesign everything.)
i have no idea what you did with that index, and what an index does. Yes, mysql
You totally know what an index is. Quick, what's the thing at the end of a book that tells you where you can find things based on keywords? ;)
21:33
lol okay, but then what does it do to the db?
It acts as a quick way to look data up, so that the entire table doesn't need to be scanned each time.
You're probably using them sometimes and don't realize it, in the form of primary keys.
well. i always have id's as primary, but never knew why that has to be so. i know they can't repeat and they should increment, that's all
@mgPePe A primary key is a thing that is unique in the table. In the CREATE above, I defined a primary key on both columns, for example. In that case, the combination of left and then right ends up being unique.
(However, it doesn't look at the pair in the other order. You can insert (1, 2) and then (2, 1) and it won't complain.)
that's kinda annoying, because every time i have to be looking for both ways, no?
@mgPePe This is correct, and it is a big annoyance.
However, given that you're already suffering through the horrors of serialization, I expect that it'd be a step up in both sanity and usability in the long term.
21:40
@Charles okay, let me give a hypothetical situation. i have 5 different words that need to part of the same phrase/expression, right? now in order to put them in a table, as you suggested, i would have to have 2^5 rows, no?
actually, when i draw it, it turns out there have to be 18 rows
If you want to perform only one query, yes. If you didn't mind running multiple queries, you'd only need a few of those rows.
the least i could drop it down is 9. then when searching i would have to check one side, check the other side and combine results
Basically, you do your first query on the first word, then gather the associated words together. Iterate over them, and perform a query on each, adding all of the results into another list, skipping over words for which you've already queried. Do this until you get no more new results.
It's annoying and abusive, but at least you aren't storing PHP serialized data in the database. :p
lol i am getting a headspin from this paragraph :) you must have a really good reason avoiding serialization in order to do all those magics. your 15k is screaming your are right, but i just can't see it
@mgPePe You can't construct SQL to query inside of a serialized string.
That's the reason against it.
21:47
heh
got it
$horror = serialize(array( 1, 2, 3, array( 4, 5, 6 ), new stdclass, null, 3.14 )); // a:7:{i:0;i:1;i:1;i:2;i:2;i:3;i:3;a:3:{i:0;i:4;i:1;i:5;i:2;i:6;}i:4;O:8:"stdClass"‌​:0:{}i:5;N;i:6;d:3.140000000000000124344978758017532527446746826171875;}
Quick, get me the second index from the array inside index 3!
But yeah, point made already.
lol
yeah, i understand. @Charles thanks for the quick fix and also for the good explanations. i will get a second opinion before i switch to tables, as you said it.
@mgPePe Just get it from someone with 10k or more rep ;)
sure ;)
one last question
is there a difference b/n serialize and json_encode?
21:52
They both achieve the same goal, but they do very different things.
JSON is an actual freaking standard, for example.
The PHP serialize format is very expressive and very PHP-specific, so it can do all kinds of PHP things.
JSON, though, is much more restrictive, and it can only represent a subset of data types
for my case, i store only ID's (digits) and i need to manage them in JS files too
This is generally a good thing, though it makes it kind of annoying when you want to, say, pass around objects of a specific type instead of objects-as-data.
that i didn't get
class Foo {} $f = new Foo(); echo json_encode($f);
That emits {}
(Which is an empty object)
JSON has no way to encode object types
This is OK, though, as it shouldn't.
Anyway, throwing arrays in there and whatnot is perfectly fine, especially if you're just going to use the data in Javascript
That's what it's for, after all.
man, i have a loooot to learn...
Tek
Tek
21:56
@mgPePe True that :)
@Charles thanks again and i am off to bed. lol, @Tek thank you too ;)
Tek
Tek
You're welcome? lol See ya
see you wonderfully helpful guys
@mgPePe Take care!
00:00 - 14:0014:00 - 22:00

« first day (272 days earlier)      last day (4901 days later) »