« first day (647 days earlier)      last day (4284 days later) » 

5:00 PM
@MoshMage
 
@Whisperity i promise i'll understand what you sent before pasting it out and feel awesome; @webarto i wish i had the patience to understand what you want to do with that function now (as in.. calling a function _i doesn't help) but i am too out of it to do it - i saved it in a safe place :)
and ill be back to share "my" findings with you guys - and then we can all party
but now: beer.
 
Zend Framework 1.11.11 on PHP 5.4.4-2~dotdeb.0
I'm so 10 days ago
 
5:15 PM
Silly IE can't even inline-block list elements...
 
I think it can, what version?
 
7 definitely didnt, 8 didn't, 9 did
though 8 not doing it was probably EBKAC
 
Yeah well, global variables is a bitch isn't it? — Truth 7 secs ago
 
Breakthrough! Scientists discover fourth building block of nature! They are now: Protons, Neutrons, Electrons and Morons!
3
 
@ircmaxell mysql_query("INSERT INTO building_blocks (name) VALUES (" . $_POST['name'] . "); <- am I doing it right???
 
5:29 PM
@orourkek Perfect.
 
It's beautiful
 
while (universe.has(morons)) { }
 
slightly better: mysql_query("INSERT INTO building_blocks (name, password) VALUES (" . $_POST['name'] . ", " . md5($_POST['password'] . ");
 
I kinda feel stupid now
 
@ircmaxell Could be simplified to while (1) { }
 
5:32 PM
@Truth Indeed.
 
@NikiC the finally() thread?
 
Four people are desperately trying to explain to me why PHP needs try/finally and why the current implementation is okay
 
SELECT * FROM users WHERE moronic IS FALSE
> 0 rows returned
 
mysql_query("INSERT INTO building_blocks (name, password) VALUES (" . $_POST['name'] . ", " . $_POST['password'] . ");
 
5:32 PM
@ircmaxell Yeah, the same, but on IRC
 
@Truth ah yes, even better!
 
But I just don't get it
 
@NikiC I agree with you in point, but not for the same reason
 
@NikiC link? (server/channel?)
 
@Truth efnet #php.pecl
 
5:33 PM
@Truth It's already over anyway ^^
@ircmaxell What was your reason?
 
I agree that the finally() block is of lesser use without generic exceptions. And having PHP throw SystemExitException on die() would definitely make finally a whole lot more useful
 
But, I think that it's also very useful as is, especially when building a modular library.
 
you think that it is useful as it?
in PHP, I mean?
 
for example: Let's say a component throws an exception that I want to let bubble. Right now, I need to catch the exception, clean up, and re-throw it. But by doing that, I'm doing two bad things. First, I'm mucking up the stack trace by rethrowing it (or wrapping it, changing the meaning). Second, I'm duplicating my cleanup code between the try branch and the catch branch.
finally solves both problems. It lets the exception continue to bubble as it was originally thrown, but it lets me clean up in a single predictable manner...
@NikiC I think it's less useful, but I still think it's useful...
 
5:38 PM
@ircmaxell The fact that there are some functions which return false on failure, some return 0 on failure, and very not many throw any sort of exception on failure
 
What kind of cleanup code would that be (in terms of real examples)?
 
makes exceptions in PHP not very useful.
 
function processFileDataPerLine($file, Callable $callback) {
    $f = fopen($file, 'r');
    try {
        while ($line = fgets($f)) {
            $callback($line);
        }
    } catch (Exception $e) {
        fclose($f);
        throw $e;
    }
    fclose($f);
}
 
@ircmaxell I kind of new that I would see this now
 
@Truth sure they are
 
5:40 PM
Let me ask you a question
Why not just write:
 
absolutely
 
function processFileDataPerLine($file, Callable $callback) {
    $f = fopen($file, 'r');
    while ($line = fgets($f)) {
        $callback($line);
    }
}
Don't you think that this would do the same thing, in a simpler way?
 
because now I have a dangling file descriptor
 
How much should one trust __destruct()? Is it better if (at the very end of execution) we call unset($instance); or should I go $instance->finish(); and put the contents of __destruct() into finish()?
 
@ircmaxell no, you don't :)
PHP cleans up after itself ^^
 
5:41 PM
@NikiC Sure you do
 
You do?
 
@ircmaxell They are only useful when making your own functions, which is important, but it would be much more useful if native functions would also throw appropriate exceptions
 
@NikiC at the end of execution of the script, not when you leave the scope...
 
no
when you leave scope
at least as far as I know (and I just asked on IRC that this is indeed true)
 
5:42 PM
hiya again
@ircmaxell I really like the wtf exception :-)
 
@ircmaxell Huh, how does it work?
 
@NikiC lxr.php.net/xref/PHP_5_4/Zend/zend_variables.c#55 Nope. It just deletes the descriptor from the resource list. It doesn't actually free it
 
@ircmaxell And what do you think zend_list_delete does? ... :D
 
@NikiC it removes it from PHP's hash table.
 
5:45 PM
Also, how would I make my script to use utf8 in the database properly? So that phpMyAdmin would show Középszintű (3) instead of Középszintű (3). Is it an error on the script's side or the database's side? Both the script and phpMyAdmin runs with UTF-8 in the Content-Type header.
 
but fopen and fsockopen and mysql_connect get resources from the OS
zval_dtor() doesn't free those resources
 
@Whisperity Is the db utf-8 encoded?
 
it does
somewhere down there it will call the resource destructor
which will also free the file descriptor
 
@NikiC find where...
 
@PeeHaa The database and the tables have utf8/utf8_general_ci set.
 
@ircmaxell heh...
 
@NikiC Except it appears that fopen()'s resource doesn't define a destructor...
 
@ircmaxell Looks very nice really
You've constructed the error arrays yourself?
 
yes
 
@ircmaxell
 
5:52 PM
17 mins ago, by Neal
http://stackoverflow.com/q/11636202/561731
^^^^^^^ pls
 
@ircmaxell Actually, gustavo said that before PHP 5.4 wouldn't even destroy the file handle if you called fclose() explicitely, but the refcount was still >= 2
So basically, calling fclose() was rather pointless always ^^
So
 
sigh
 
To summarize: I think that finally is trying to fight a problem that is only very, very rare in PHP. And it does so in a rather ugly way.
@ircmaxell Targeting what in particular?
What PHP did or what I say?
 
hey guys, can u please suggest me a/few open source php proxy softwares which can be used in ip:port ?
 
@NikiC what PHP did
 
5:55 PM
@NokImchen What do you need it for?
 
@NikiC not in the least. File streams are the easy example. There are lots of others...
 
@ircmaxell Then go ahead ;)
 
Til now I have seen either file streams or ... nothing ^^
 
@PeeHaa i want to open gmail.com and access email using cURl/guetto/simplebrowser but i cant cos gmail is asking for security questions which i cant fill :( thats y m tring to use proxy and access gmail so that i can enter the security questions sounds kinda dumb :(
 
5:58 PM
Wow. You write hard to read sentences
 
anyone use geany?
 
Ok, let's say you're communicating with a third party system
such as gearman.
 
@PeeHaa heheh
 
or a database
and you need to deliniate start and stop conditions (start of process, stop of process)
 
@PeeHaa ok, i'll write one sentense at a time :P
 
5:59 PM
without finally, you'd need to duplicate the stop of process reporting
 
@NokImchen Why wouldn't you be able to answer the security questions and what would you gain by proxying the request?
 
and it may sound like an edge case, but I've ran into it a number of times...
 
@ircmaxell And if you communicate with a DB etc, don't you have an object managing that communication?
An object with a destructor?
 
for the resource, yes
but for the application level communication?
 
@PeeHaa i cant answer the proxy cos those php headless browsers are unable to submit that form! i dont knw why! :(
 
6:00 PM
ah, I see what you mean
could you give an example for that? what kind of "cleanup" communication do you need?
 
Well, one simple example would be a master slave system
 
Can't answer proxy. PHP headless browsers? Sorry you lost me
 
where you have slaves "pulling" jobs from the master, marking them as "in progress", and then working on them
 
@PeeHaa with the help of a proxy, i can login easily manually. Yhis will enable me to enter the security question manually :0 And this would let google to savehostgator ip address as a valid one to log into my account :)
 
user image
2
 
6:01 PM
hehe @Neal
 
@PeeHaa oops sorry! i'm so sad and in a hurry also :( Thats y typing mistake :(
 
@PeeHaa DELETE 'EM
 
@PeeHaa those php headless browsers are unable to submit the form which asks for security question! i can sugmit any damn forms except the security form! i dont knw why! :(
 
"You have already voted, but the voting has been cleared by a moderator" wtf?
 
Or, perhaps another option would be in the case where you're processing a lot of data and need to create a temporary table in MySQL. But you need a materialized table, because TEMPTABLE doesn't work with all use-cases. So finally would allow you to clean that temporary table up...
@NikiC where?
 
6:04 PM
I tried to star the cookie monster
 
Oh, I cleared the start on it
 
how do you clear stars?
and also, why?
 
On the right box, hover over the message, and click the down arrow that appears. There's a link to "cancel stars"
why? to hopefully keep the list of starred messages reasonably on point...
Also, that's how you pin messages
 
@ircmaxell why did you clear the stars on it? cookies are on point...
 
ah, now i see it
but why clear stars on the cookie monster?
 
6:06 PM
because I'm a bad person
 
^ starred
 
@ircmaxell we can only star things that are part of ur blog?
 
poor cookie monster :(
 
ATTENTION PLEASE:
 
@Neal look through the list of starred posts, and tell me how much content that I didn't create is there
 
6:07 PM
:)
 
@ircmaxell but a Borat post is on point?
 
0
Q: Ignored users still appear in the 'rooms you are currently in' message preview

rlemonWell it might not be a huge issue to some (I suppose it depends on how you use the chat system) but when I "Ignore this user everywhere", their messages still appear on the sidebar for the rooms I'm in if they say something. Albeit I can ignore this feature and the text within it, I just find it ...

 
it's at least midly insightful
 
As are cookies.
 
I thought the star system in chat was voting for interesting posts, regardless of content?
 
6:09 PM
@Event_Horizon Thats what I thought... till @ircmaxell came around :-P
 
I was writing a relation table, something like: movies->movies_to_genres->genres
 
I don't know about you guys... but I only star for the Unicorns.
 
so basically, each movie has movieID and genres have genreID
 
Because we'd have to witch hunt if it wasn't.
 
the relation table has two columns, genreID and movieID
 
6:11 PM
hello , please suggest me that is it better to use the mvc architecture like zend,symfony or use the own custom mvc architecture
 
@rlemon nothing happens/
 
the question: do I need to have an index in the relation table?
 
=
?
 
@Christian yes
 
@ircmaxell explain please
 
6:12 PM
@PeeHaa install userscript (remember it's a userscript so it's js content loaded to the page) then refresh the chat and star or unstar something
 
explain what? the benefit of indexes?
 
the benefit in this case, yes.
 
@rlemon Nopez doesn't work
 
umm. the same benefit of any other index...
 
then you are doing it wrong.
Chrome this works.
 
6:13 PM
@rlemon I blame Chrome canary build for this one
 
FF you need greasemonkey or something similar to run the userscript
 
@ircmaxell I'm asking since I won't be using the index column anywhere.
 
HUH?
index column?
 
@rlemon not workin on my chrome either
 
A database index is a data structure that improves the speed of data retrieval operations on a database table at the cost of slower writes and increased storage space. Indexes can be created using one or more columns of a database table, providing the basis for both rapid random lookups and efficient access of ordered records. In a relational database, an index is a copy of one part of a table. Some databases extend the power of indexing by allowing indices to be created on functions or expressions. For example, an index could be created on upper(last_name), which would only store the upp...
 
6:14 PM
did you people install the script then refresh the page?
then you need to star something
 
@PeeHaa yea, i hate it.... canary build keeps blocking everything... :-(
@rlemon we can't canary build blocks it.
 
@rlemon sheepish look forgot refresh
it works for me
 
lol
 
You can't even install extensions anymore by just clicking a link (which isn't the "market")
:(
 
@ircmaxell I'm confused. I'm talking about a primary key. Why would I need a primary key in my case?
 
6:15 PM
@PeeHaa you can
well I can
 
Hi to all
 
You have to download it and drag 'n drop it in the extensions page
 
The only unique data would be genreID+movieID at the same time
 
nope
 
@rlemon With canary you cannot
 
6:15 PM
Hey guys.. mind having a quick look over this code and telling me what's wrong? for some reason it's always returning the success statement, regardless of the validity check.

$validProgram = 0;
$validProgramCodes = array('ITFZ', 'ITFC', 'ITFP', 'ITFE', 'ITFL', 'ITFS',
'ITFF', 'ITFM', 'ITFT', 'IEME', 'ISMK', 'IPKT');

if ( isset( $_GET[ 'category' ] ) && isset( $_GET[ 'subcategory' ] )
&& $_GET[ 'category' ] != '' && $_GET[ 'subcategory' ] != '' )
{
$selectedSchool = $_GET[ 'category' ];
$selectedProgram = $_GET[ 'subcategory' ];
 
ohh maybe canary
 
@Christian Primary Key is very different from an Index
 
can i display csv data in spreadsheet after uploading in web page
 
@rlemon Will be introduces in v21 or 22
 
But, in your case, why not define the PK as a composite of both IDs?
 
6:16 PM
@TomC Yes, yes I do mind.
 
any idea or reference could be very helpful
 
@Neal :(
 
@ircmaxell Well, phpmyadmin complains "no index defined!" on that table.
@ircmaxell How's that done?
 
@PeeHaa what will?
 
hello , please suggest me that is it better to use the mvc architecture like zend,symfony or use the own custom mvc architecture
 
6:17 PM
@Christian because it's stupid
And it means literal index, not "no primary key"
 
@ircmaxell Allow me to star that.
 
Is any one noticed my Question ?
 
@ircmaxell I've figured as much. How's the composite key thingy done?
 
2
Q: How to properly create composite primary keys - MYSQL

filipHere is a gross oversimplification of an intense setup I am working with. table_1 and table_2 both have auto-increment surrogate primary keys as the ID. info is a table that contains information about both table_1 and table_2. table_1 (id, field) table_2 (id, field, field) info ( ???, field) ...

 
6:19 PM
@gowri I don't understand what you mean
 
@ircmaxell Cool. Thanks @ircmaxell!
 
@MikeB: thanks for your attentions.
 
> Discussion for all things PHP - Don't ask whether someone is here or can help. Just tell us your problem. If anybody can and wants to help, they will.
 
i need to display the xl data
after uploading the csv file in web page
like google docs
 
What's xl data
 
6:21 PM
XL = spread sheet . just two column like key and value
 
There - Anyone who need incentive to install and use UnicornStars
 
Ho
 
someone know how to answer a cmd prompt in the BAT file?
 
Hi Ho ... it's off to work we go
 
6:23 PM
i have : C:\wamp\www\ftpDemandes>xcopy /s/e C:\wamp\www\ftpDemandes\demandes R:\DEMANDES_
EN_COURS\DIRECTES
Remplacer R:\DEMANDES_EN_COURS\DIRECTES\dossier1\1312825770.jpg (Oui/Non/Tous)?
and i want to reply "Tous"
 
@MikeB: do you got my question
 
@gowri No, I don't understand.. Are you looking for something to allow people to edit spreadsheet files on the web like google docs?
 
Yes
 
Google Docs :) - I don't know of another standalone tool
 
My answer is :
echo t | xcopy /s/e C:\wamp\www\ftpDemandes\demandes R:\DEMANDES_
EN_COURS\DIRECTES
 
6:28 PM
i not going to provide reach editing option lik GDoc
just want to copy and past data
 
Is there a simple way to determine if a string is a MySQL function?
 
or display the uploaded csv data as row and columns
Any budy : My tool will full fill if this feature exist
 
Sorry, read too fast
 
Yeah, I'm thinking things like NOW()
Basically, I have a function that takes a PHP array and creates an INSERT INTO statement using $key=>$value. It works great, unless I'm trying to use a function like NOW(). The function reads NOW() like a string and escapes it.
 
Ah, so you're setting an array of key => values and one of those values is NOW()
 
6:36 PM
yeah, like creation_date=>NOW()
It'd turn into INSERT INTO posts (creation_date) VALUES ('NOW()')
 
Part of me wants to say that the escape function should be aware of those types of values
i.e. mysql_real_escape_string('NOW()') (and it's mysqli/PDO equivalents) should be smart enough to tell what that is
 
I'm using Joomla's database object
 
Sorry, I'm not familiar with Joomla and I can't think of a clean, programatic way of determining if a value is a mysql reserved-word or function
 
@rlemon Extensions not installable directly from link
 
Well, thanks for helping. I was hoping there was a simple way. Fortunately I only need NOW() (for now) so it's only a matter of a quick check if $value === "NOW()"
 
6:44 PM
Might be worth posting a question
 
I figured it was something easy and I was just a noob, but I'll go post it now.
@Neal because you blatantly stole it from JS room.
 
Why do the JS people get to have all the fun :)
 
I'm having a hard time figuring this out, I need to update in "realtime" a list of 100 domains (HTML list), with status codes returned from curl_multi, but I can only open one connection towards backend. I have something here: f4c3b00k.com but it opens 1 (towards backend) connection per domain.
 
@webarto I never trusted curl_multi - is a job/message queue out of the question?
 
6:49 PM
@MikeB Cos they get Macs and work in web design offices next to a Starbucks? PHP devs all use Linux netbooks and try to grow a bigger beard than their rivals, so they get shoved into the basement office :(
 
well, I was told connections need to be "async" in backend, and I can open only one connection towards frontend, but update all domains asynchronously... it sounds to me that it is not possible in that manner...
 
@GordonM Ah crap, beards matter? Might as well start calling me patches
 
git add . && git commit -m "Fixed throw of error for nonexistant configuration file and requring page refresh." && git push steam development I should really get some sleep now. This utterly went into the wrong window.
 
hehe
 
Hey how much this function is safe from xss and sql injection
 
6:53 PM
0
Q: Find if string is MySQL function in PHP

SomeKittensI have a function that takes an array and creates a SQL statement based on they key/value pairs of the array. For example: name=>SomeKittens It'd turn into (`name`) VALUES ('SomeKittens') The only problem is when I use a MySQL string function such as NOW(). creation_date=>NOW() t...

 
Hey.
What could be worng with this mysql query:
    UPDATE %s
    SET `taskOrder`=`taskOrder`+1
    WHERE `relatedTaskId` = ?
        AND `taskOrder` >= (
            SELECT `taskOrder` FROM %s  `tr`
            WHERE `taskId` = ?
    );
 
@SomeKittens hey you question is tagged with php so you can also you time() function
 
@Neal I don't think you can select from the same table you're updating
 
I get this error: Error Code: 1093. You can't specify target table 'taskrelationships' for update in FROM clause Where %s is taskRelationships
@MikeB I have done it before.
 
@BasicBridge line 76: get_magic_quotes_gpc() magic quotes has been deprecated.
 
6:56 PM
@PeeHaa to me that seems like a step back. I like my one click extensions (maybe like greasemonkey they could provide a better way of allowing/disallowing and a prettier installation modal would be nice.
 
@BasicBridge That's a workaround hack. NOW() is only an example. I want it to work with all MySQL functions
 
@rlemon Yup. I dislike it too :(
 
@Neal There's ways around it.. something to do with faking a join or something
 
I did it here:
5 hours ago, by Neal
            INSERT INTO %s (`taskId`, `relationshipId`, `relatedTaskId`, `taskOrder`)
            VALUES ( ?, 1, ?, IFNULL((  SELECT
                                            MAX(`taskOrder`)+1 as `maxOrder`
                                        FROM
                                            %s `tr`
                                        WHERE
                                            `relatedTaskId` = ?
                                        GROUP BY `relatedTaskId`), 1)   --  if the max is null, then the order is `1`
 
@Whisperity thanks for noticing. is there any thing else I can do. for protection.
or improve this function
 
6:57 PM
And it works fine
 
@ircmaxell Care to promote passlib? stackoverflow.com/questions/11637445/… :)
 
UPDATE table, (SELECT ... FROM ..) table2 SET .. .. WHERE table.id = table2.id
I might be way off
That's an insert, updates might be different
 
What happens when chrome versions exceed a pretty or nice version number... or are we really expecting Chrome 247
 
@MikeB There is an update on supe key in that older query
 
@BasicBridge line 9: $output[$key] = escape_data($data, $strip, $charset); The argument list of escape_data() in line 1 and the passed arguments in line 9 is not the same. You are passing $charset in the recursive call, but it gets treated as $xss when executed.
 

« first day (647 days earlier)      last day (4284 days later) »