« first day (865 days earlier)      last day (4098 days later) » 

11:03 AM
@DaveRandom I'm just going to write a Python plugin/extension for Mercurial instead
 
Hey I've been trying to implement levenshtein function in mysql and using this: artfulsoftware.com/infotree/queries.php#552 but when I paste the code in my mysql editor, it throws that there is syntax error where is first variable declaration (line 4).
 
How can you see who approved an edit?
 
@AdamLynch Sorry my computer just properly bailed on me for a minute, had to reboot. That should work, does the mercurial command work when you run it on it's own?
 
@wes there is no case of disliking here... dont spread hatred, he is not a criminal, he is an inspiration to everyone, even while suffering with cancer he achieved all what he had... once was thrown out from his own company, but courageously fought and came back to the company.... these are all not just stupid things as you think @wes :)
 
11:13 AM
"he is an inspiration to everyone" uhhhhhm that's a bold statement
@prashu132 Don't flag that man
 
Why is the starred list not loading for me
 
@BoltClock It happens sometimes. refresh always fixes it for me
 
@PeeHaa Done. Always a strange thing, chat is.
 
Ah, short-sighted people :D stackoverflow.com/questions/15110283/…
 
@DaveRandom what do you mean?
If I don't add a pre-commit hook to the .hgrc file and run hg commit -m "message"??
yeah
 
11:19 AM
@AdamLynch Well that error is bitching about the regex you passed to grep, so does the hg showconfig | grep -P -o -i -e "(?<=^bundle.mainreporoot=).+$" command work on its own?
 
Now I'm either gonna write a python script for it or else get it working with a one liner which is windows-compatibile
 
9 messages moved to bin
 
@DaveRandom yes
 
1 message moved to bin
 
11:22 AM
@thecoshman In case you are having troubles comprehending what those binned messages mean: your presence here is not needed ktnxbye
 
@PeeHaa oooh, right, got-ya
 
@AdamLynch Wierd, stuff like this is totally working for me. Very contrived example but uses exactly what you are doing: echo $(echo "hello world" | grep -Poie "(?<=hello ).+")"/.hg" outputs world/.hg
 
be back in awhile
 
Yay C++ bashing
 
hi can someone please help me a sec,

say if this was in a class

	public function current_user(){
		$statement = $this->database->prepare("SELECT * FROM agents WHERE username = ?");
		$statement->bindParam(1, $_SESSION['logged_in']);
		$statement->execute();
		$result = $statement->fetchAll(PDO::FETCH_ASSOC)[0];
		$first_name = $result['first_name'];
		$last_name = $result['last_name'];

	}

how would i access the first & last name $vars?
 
11:30 AM
No not really c++ bashing. At first I was convinced it indeed had to do with the language, but there are actually people in there which are not that bad @DaveRandom
 
@PeeHaa was that for me?
 
@ConnorMiles $class = new ClassName(); echo $class->$first_name;
 
@Jimbo yes that didnt work
 
BUT, you need to set it as a class variable in current_user(). So: `$this->first_name = $first_name;"
 
@ConnorMiles Yeah that's why I pinged @DaveRandom for it
:)
 
11:31 AM
lulz
 
@Jimbo so to do that i would have to make a public $first_name; ?
 
Well you don't have to put that at the top, but it's considered best practice
 
mornitngi
 
(I think) it helps people (and yourself) looking at your code in the future to better understand it :)
 
@webarto monrinig
 
11:32 AM
Lol.. mornitngi @webarto
 
@Jimbo ok cool thanks people
 
blind typing they said, it will be *zZzZz*
 
@ConnorMiles I completely get your question - you need to read up more on OOP and how and why you set class variables :)
(Or are they class properties?) .. Ah well
Object properties? D:
 
@Jimbo yes
 
or members?? ;) @Jimbo
 
11:34 AM
even though they are no different to $variables
 
@PeeHaa loves guy's members ;)
 
@Gordon Note #111303 has been deleted and removed from the manual
 
@salathe how do you do it?
 
@PeeHaa I found your website really amusing! Is it supposed to just say "File not found." and that's it? :D pieterhordijk.com
 
@salathe but but but how?
:)
 
11:36 AM
@Gordon Log in to master
 
@Jimbo I actually still need to set my main up :P Some subdomains are working though
 
Then visit the doc page, you'll see:
 
ooooooooooowh shiny
 
Wow can I delete my notes too?
I contributed like... one or two of them
 
Small architectural question - is it best to (1): Place CSS/JS includes directly within my view (.html.php) files or (2): In the template class, run an append_stylesheet() method before rendering the view? Or does it not really matter?
 
11:39 AM
@BoltClock If they are reeeeeealy crap I would be more than happy to delete them for you ;)
 
@Jimbo what's append_stylesheet() ?
 
@Ocramius Is a made up function in my template class :)
 
@BoltClock If you have a php.net account
 
any good ide(editor ) for ubuntu ?
 
11:41 AM
Just wondering which is best, if I create a new Template(); then either: $template->render(); with the JS/CSS includes just in the html file, or $template->append_style_sheet('blah/blah/file.css')->render();
 
@Jimbo probably use that one, since it will eventually allow you to define how to output them at a later point in time
 
@NullPointer - I use NetBeans
 
@Gordon Sorry I missed the notification, saw it only now on main site :(
 
Its just perfect
 
@Rikesh in ubuntu ?
 
11:41 AM
@Jimbo and apply some crazy stuff such as appending mtime or rewriting URLs
 
@salathe ah, i didnt find the login to master :D
 
@NullPointer yes ..why ?
 
@Ocramius Sounds good :)
 
@Jimbo I actually have 2 helpers
 
@Rikesh ahh i have to download it for ubuntu ... i am using netbean too but in win8
 
11:43 AM
@Ocramius What ya got?
 
head(Script|Style) and inline(Script|Style)
 
Oh okay cool
 
hiya
 
@NullPointer Ubuntu Software Center will make easy for you
 
Quick question: I'm not getting this error on one page, but it's coming up when I copy the code and change the variables on another page on a similar form:

"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'char) VALUES ('tag test','char test')' at line 1"

Any thoughts?
BTW, Ocamius, love your avatar :3
 
11:45 AM
@Reidmere \o/
 
@Reidmere So, what's your SQL code :D
 
What's \o/ mean again? >_< lol
 
ah lol thanks XD
Anyhow, the code:

$sql="INSERT INTO cosp (tag, char)
VALUES
('$_POST[tag]','$_POST[char]')";

if (!mysql_query($sql))
{die('Error: ' . mysql_error());}
else echo "1 record added";
 
@Reidmere please dont use mysql_* function
 
11:50 AM
come again?
 
76
A: Why shouldn't I use mysql_* functions in PHP?

NullPointerPHP offers three different APIs to connect to MySQL. There are the mysql, mysqli, and PDO extensions. The MySql_* function are very popular but use of MySql_* function is not encourage anymore .The documentation team is discussing the database security situation, and educating users to move awa...

 
So then, what should I replace such functions with, mysqli, or something else?
 
while you can use it but it no longer developed. thus no longer supported.
 
@Reidmere pdo defiantly
 
Anonymous
hmm
 
11:52 AM
pdo? I'm clueless to what that even is lol
 
head to documentation page then
 
@Reidmere check the post above i have posted
 
closest to mysql_* would be mysqli_* then
 
its good enough to know what is pdo ... and how to do basic stuff further check the manual
 
@Reidmere get started at youtube.com/watch?v=cbiLi0CBHNM :)
 
also :D
 
I'm on it null, and I see how it works so far, but I kind of have a learning disability of studying by simply reading, I need examples or hands on...
Thanks, so like in example, what's the equal PDO command for PHP_connect?
 
ahh .. reading make us able to write .. example
 
somewhat similar to me. maybe this would help you: wiki.hashphp.org/PDO_Tutorial_for_MySQL_Developers
 
@Reidmere Regardless of the driver you are using, the problem with you query is that CHAR is an SQL reserved word, you need to quote it if you want to use it as an identifier, or use it's FQN
 
11:55 AM
AHHHH
thanks I'll try that... and any word if/when Mysqli may be depricated?
 
Preferably don't name databases/tables/columns with reserved words as well
MySQLi is not scheduled to be deprecated.
Certainly not for many years,
But use PDO
 
I may learn PDO later, but MySQL is pretty much all the PHP I know :P
 
linux is damn fast than window ...and good looking .. gonna love it
 
@Reidmere ^^
PDO is pretty simple, that's a decent tutorial
 
@NullPointer you will gonna love it for sure...I'm loving it
 
11:57 AM
I'm currently tinkering with a few languages atm, but thanks for the info, It's definately on the "to do" list, after my current project and my wife.
And I'm bookmarking it :)
 
@Rikesh ahh developer couple :P
@Rikesh installing lamp now ..
 
"So Mr Griffin, where do you see yourself in 5 years?" "don't say doing your wife don't say doing your wife don't say doing your wife don't say doing your wife Errr... doing your... son?"
5
 
@NullPointer linux + git + netbeans ;)
 
@DaveRandom lmao
 
Nope, that doesn't reboot my VM
strange
 
11:59 AM
@Rikesh installing
 
xD
 
And the Char thing was the problem thanks alot! ^_^
 
lol @DaveRandom
 
@Ocramius btw, you played SMBX?
 
@NullPointer - yeah php developers always supports open source ;)
 
user652649
12:00 PM
@DaveRandom how would you do a pagination script with pdo? (since it doesn't support num_rows.. not a provocation.. i'm asking for real :P )
 
@Reidmere nope
 
@wes rowCount() ?
 
user652649
i didn't test but rowCount seems to return "affected_rows" not num_rows
 
Wut?
 
what with pagination issue. i don't get it
 
12:04 PM
If the last SQL statement executed by the associated PDOStatement was a SELECT statement, some databases may return the number of rows returned by that statement. However, this behaviour is not guaranteed for all databases and should not be relied on for portable applications.
 
@wes Actually rowCount() works just fine with MySQL, contrary to popular belief. But either way, you wouldn't do that when writing a pagination script anyway ;-) Use SELECT SQL_CALC_FOUND_ROWS <query> followed by SELECT FOUND_ROWS() to get the total number of results
@Reidmere for reference dev.mysql.com/doc/refman/5.5/en/reserved-words.html - try and avoid using all of those words on that page as a name for anything
 
when I see Justin Bieber and similar I start to miss Backstreet Boys...
 
user652649
yes
 
user652649
is SQL_CALC_FOUND_ROWS some standard?
 
@DaveRandom SQL_CALC_FOUND_ROWS is slow as hell
 
user652649
12:06 PM
or is it mysql-only ?
 
@PeeHaa No slower than applying ORDER BY, which you usually are doing in a pagination script
 
@Ocramius Super Mario Bros X is the best fan game I've ever played in my life, and honestly puts New Super Mario Bros Wii to SHAME... ;)
 
@DaveRandom I don't read posts I just react ;)
 
:-P
 
user652649
@PeeHaa better than running the query twice :P
 
12:07 PM
@wes depends
 
Hammer suit, racoon and tanooki suits, yoshis, goomba shoe, ice flower, and you can play as all the Mario 2 chars and as Link from Zelda 2 :3
 
SQL_CALC_FOUND_ROWS does a full table scan @wes IIRC that is
 
user652649
@PeeHaa in my case query is a fulltext search
 
user652649
don't know what a "full table scan" is @PeeHaa :P
 
@wes It means the engine has to visit and inspect every row
 
12:10 PM
When it inspects every row, does it just count that they're valid, or just counts like NumRows?
 
But the same is (usually) true if you are applying an order to the results, so for most pagination mechanisms it won't make a noticeable difference
Although indexes can speed ordering up, they cannot speed SQL_CALC_FOUND_ROWS up
 
Anybody know of a function to check of a hyperlink in a form is valid?
*if
 
Define "valid"
 
@Reidmere Yeh it's just counting the number of rows in the table, but it's way more I/O
 
Ah thanks :)
 
user652649
12:12 PM
ok btw i will test both solutions
 
@wes With a FULLTEXT search there's a pretty good chance that it won't make a noticeable performance difference because it's already slow as shit anyway
 
user652649
lol
 
@Reidmere not playing videogames since... can't even remember :(
 
lol you may wanna check it out...

On another note, I'm trying to figure out a function to use for PHP to check if an image URL linked in a form is valid... any ideas?
 
Implement what? Spamming a link nobody wants to look at isn't going to help anything
 
12:17 PM
check out SMBX that is lol
 
Ah! chaning of te3xture of floor , wall etc..
 
@Reidmere - I'm not sure what you asking but may be file_exists($image) is what you need ?
 
Thanks, Ill look up how to use that :)
 
@Reidmere Again, define valid. Do you mean "url is a valid image" "is an existing file" "is an image that GD can load"
 
@Gaurav Those images have been edited in Photoshop probably: so a load of images are in a folder, each with different floors
 
12:19 PM
@Rikesh The HTTP wrapper does not support stat() so that's not going to work
 
I'm fairly creative with PHP, but don't know all the little things...

And yes, what I mean is just any form to make sure the URL they are linking is actually an image to show up in a gallery for uploaders
 
@Gaurav Then when you click on a button - or an image with a link - it removes the image and then loads another one
 
Ok jimbo thanku..
if in caase more then 2000 combinations w have we need to build 2000 images for each combination ?
 
@Reidmere You will need the GD extension, and then you can use the terribly named function getimagesize() to download the image and verify that it at least looks like an image. If it does that function with return an array of image meta-data, if not it will return FALSE and emit a warning (which sucks)
 
@Gaurav I guess so!
 
12:22 PM
4 messages moved to Trash can
Thee old trusty trashcan :)
 
@DaveRandom So then, is there a simpler, less pain in the arse way, of doing so?
Even if it just checks that the URL exists?
I can just then check that it ends in .jpg. gif, exc, right?
 
But.. but.. you can easily hide malicious code within a file with the wrong extensions..
 
Hi all,
this sql works fine from phpmyadmin, but when my script runs it, it gives an error :-/

"UPDATE mormvotes SET votes='4000' WHERE choice='mam'";
 
@Kishor remove the double quotes from either side, then run in script
 
@Kishor an error is not a valid error message
 
12:24 PM
So then it's worth the extra hassle/errors?
 
@Kishor You're doing $count within single quotes
It needs to be double quotes! So switch it to...
Argh why's it deleted..
 
@Jimbo haha
 
user652649
@Jimbo wtf?
 
I can't help you if I can't see your SQL @Kishor
 
well, figured it out. Cheers! @Jimbo @PeeHaa
 
12:26 PM
What @wes?
 
@Kishor :)
 
You can't do '$var' in PHP, it has to be "$var", amiright
 
@Jimbo It's inside a double quoted string
 
user652649
it was inside double quotes...
 
Not according to the code that was just removed it wasn't...
 
user652649
12:26 PM
"was" before he deleted the sql :P
 
@Jimbo I don't think you are
 
"this '$yay' works"
 
Anonymous
did anyone miss me?
 
It was " sql ... '$var' ... "
 
@Jimbo - I dont think so Jimbo.
 
12:27 PM
@PeeHaa Srs!? :o
 
user652649
> "this '$yay' works"
 
Actually it was me making a mistake at some other part of the code which made the error.
 
Ohh, I didn't see the outsides
 
This works
 
12:27 PM
@Jimbo Yes srs :)
 
xD
I try to help, and fail :(
 
15
A: Super fast getimagesize in php

webartofunction ranger($url){ $headers = array( "Range: bytes=0-32768" ); $curl = curl_init($url); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $data = curl_exec($curl); curl_close($curl); return $data; } $start = ...

:P
 
Anonymous
I felt missed, today. Maybe wrong room
 
@Jimbo how do u use variables, say you want to concat without escaping?
 
@iroegbu erm... $var1.$var2 ?
 
12:28 PM
huh?!
 
Thanks web :)
 
Anyone here having a decent fastcgi interface written in PHP? :)
 
add a string to that
and make one of them a variable
array type
 
Anonymous
why is it the isset() does not work, for constants ?
 
@PHPNooB constants are set.
 
12:29 PM
$var1[0].$var2."another string" ?
 
@Ocramius defined :P
 
@webarto right :)
 
@Jimbo you fail cause you keep assuming & reply :p Why you just not ask for some more information to user lol
 
@Jimbo don't escape from the string
"a string {$bar['key']} another variable {$foo}"
 
@Rikesh You're right!
@iroegbu "a string".$bar['key']." another variable ".$foo ... lol
 
Anonymous
12:32 PM
take this for instance. define('PAGE', 'index.php'); now if you check as isset(PAGE) {} gives out an error
 
@PHPNooB the method is defined
 
@Jimbo lols... you are escaping
put all within ""
 
@iroegbu "a string $bar['key'] another variable $foo" then?
 
Anonymous
i'll check. Thanks for the Germany manual I can't read :)
 
12:36 PM
@Jimbo assume 'string' is someone's name and want it possessive
a string's $bar['key'] another variable $foo
that won't work
 
@iroegbu No idea then :P
 
lols
you have to do it my way for that to work
put curly braces around the variable if they contain quotes
 
{array['key']}
 
@iroegbu - +1. I wanted that bit of knowledge :D
 
12:39 PM
@iroegbu Oh really? Curly braces work!?
I assumed that was for kinda boilerplate stuff like {name} from smarty, or things like that
I guess that's in the HTML though...
 
they do work
 
lol!
 
"hello {$data['name']}!"
 
exactly
 
But.. "hello $data['name']!" would still work, right?
 
12:42 PM
make hello a noun
 
$data['name'] = 'ircmaxell';
echo "hello $data[name]!";
md #fail
 
@PeeHaa No... please no...
 
@ircmaxell Hey don't look at me. I hate both styles
 
Oh cool, just tested the { }, awesome
How did I not know that?
 
@Jimbo Bacuse often you would want to concatenate or *printf it
 
12:45 PM
nice to know. usually just concatenate it
 
@ircmaxell You raise a valid point
 
alright, here's one for you: This keeps saying the path does not exist:
if (!file_exists($_POST['url'])){echo $_POST['url']." does not exist";}
else {...
 
@PeeHaa: Finally There was a folder httpsdocs in host and inside that folder there is clone of all files, I am checking, but I am happy because got the answer from mysteries issue. Thanks for your time :)
 
@gowri np. Glad you resolved it :)
 
12:47 PM
@gowri - I asked you to check that :(
 
@Reidmere I'm going to guess here: that path does not exist?
 
I tried 3 URLs lol... they exist
 
@Reidmere url or path?
And you are using an url as argument in file_exists because?
 
URL
 
@ircmaxell :mindblown:
 
12:48 PM
@Rikesh : yes That time I don't have privileges to check, just now i got the permission, Thanks you toooo :)
 
@Reidmere And you are using an url as argument in file_exists because?
 
posted on February 27, 2013 by Lorna Mitchell

If you're interested in becoming a Zend Certified Engineer and are local enough to make it to the next PHP North West User Group meeting on Tuesday, 5th March in Manchester (UK), then come along! I'll be giving a talk and welcoming questions and discussion around becoming ZCE, why you might bother, what is involved, some tips for the exam itself, and pointers to resources to help you (yes the

 
To verify that the URL from the form is valid, before adding the URL to the database
 
who would have thought I would agree to something coming out of the RoR community: 37signals.com/svn/posts/3453-no-more-remote-work-at-yahoo
 
@Reidmere hmmmm just no
 
@gowri - your welcome :)
 
no on what?
 
file_exists check whether a file or directory exists on your local machine @Reidmere
 
I thought I've read it can be used either way
 
You read wrong
Use parse_url to check whether it looks even remotely like an url. To find out whether there really is something on that url you would have to make a request
 
12:52 PM
file_get_contents
you've read
 
is there a way to turn on mod_rewrite without touching httpd.conf?
 
@iroegbu You go to mods-enabled folder and make a soft link to the rewrite file there? :)
cd /etc/apache2/mods-enabled
Then... ln -s ../mods-available/rewrite.load rewrite.load
Then sudo service apache2 restart
 
Heh...
 
ok... let's assume, I'm hosting a website
not my local machine
not a dedicated server
 
cloud? shared? vps?
 
12:57 PM
Ran out of all possible votes for today =p
 
:s shared
all I have is cPanel
 
@Jack Noooooooo :( We need your votes
@iroegbu contact the party that does the hosting to enable it for you
 
@PeeHaa ok
 
@PeeHaa Sorry, only have a few flags left ;-)
It's that damn "close all typo questions" question's fault!
 
@Jack tell me i have 40flag yet
 
1:00 PM
47
Q: Close all the typo questions

Wesley MurchThis simple search yields an impressive amount of "too localized" questions related to typos by the OP: http://stackoverflow.com/search?q=body%3Atypo+is%3Aanswer+isaccepted%3Ayes Most of the accepted answers are like this: ✓   You had a typo, "passwrod" should be "password". OMG ...

 
@BoltClock are mods vote limited like regular users?
 
^^ @NullPointer
 
@Gordon What do you mean?
 
@Gordon How can you compare mods with mere mortals? :)
 
@BoltClock Meaning, do you only have n upvotes and x closevotes available in y hours, etc?
 
1:01 PM
Damnit @DaveRandom what did I tell you about not diving into phpweb?!?!?!?! Please come back!!! Don't do it man
 
@PeeHaa Zend Web App ?
 
@PeeHaa I thought better of it when my local clone took nearly half an hour to resolve the deltas
 
:P
 
I still might rewrite some of that abysmal jQ at some point though, it's a little painful just knowing I'm allowing that to run on my computer
 
1:03 PM
@Gordon Hmm I've not closed so many questions in a day, but we still only get n up/downvotes a day, same as regular users
I think our close votes are unlimited though
Well shit, I just got invited to a 6v6 in TF2, I've never played 6v6 before
 
@DaveRandom Keep in mind that prototype is also still coming
 
@PeeHaa NOOOOOOOOO
@DaveRandom come back, we love you!!!
 
github.com/fieryprophet/php-sandbox <-- interesting (if not needs DRASTIC cleanup)
2
 
@ircmaxell missing even a single test :(
 
1:13 PM
and has a 2k line class
but actually works, so can't hit him too bad over it..
 
@iroegbu Have you tried RewriteEngine On in .htaccess :) ?
 
@ircmaxell Now that's freaking awesome
 
@ircmaxell oh, ofc that :) It's a nice PoC
 
So it means you can run sort of codepad?
 
1:15 PM
@webarto I take it you're another one that #failed to get viper7 running? :P
 
@PeeHaa N ... Yes :)
 
in theory... I think he means it more for other usages though
 
Registering DOMAIN name php.net.so
✔ 200 Command completed successfully
get freaky
 
@ircmaxell Wow, that's like the Caja for PHP? :)
 
@webarto yep
the project works fine on my local machine
had to edit httpd.conf though
 
1:28 PM
Ask your support to enable mod_rewrite, although there is no reason to disable it.
 
ok
@webarto BTW what I'm getting is a "500 Internal Server Error"
 
@iroegbu Look into servers error log.
 
I need some advice and guidance on setting up a combination split / dropdown menu in Joomla 3.0
I have posted the following question on SO
0
Q: Creating a combination of a split menu and a drop down menu

alisamiiI am working on a Joomla 3.0.3 site using the Gantry 4.1.7 Framework and am unsure about how to create a combination split / dropdown menu system. As you can see from the mockup below, the design calls for 1st level menus and 2nd level menus to be displayed inline. 3rd Level menus however, are d...

If anyone can advise me, I would much appreciate it.
I know this is a PHP chat room, but there isn't a specific CSS or Joomla chat room
 
1:50 PM
No idea, sorry.
 
@webarto No worries. You have told me before that Joomla isn't your platform of choice. Just throwing it out in case someone here can help.
 
@alisamii Hey, you're new to programming according to your profile right?
 
@Jimbo relatively...I have been involved with web site design for many years, but more on the level of managing others.
 
I can't help with your specific problem, but I have some advice which I found useful - although some others may disagree, it's personal opinion and a controversial topic so take as you will... I didn't learn a framework first. I learned how to do the coding, where I was doing it and why, and then I learned how a framework can make things easier and faster, and in the process I understood why the framework was doing what I needed. :)
 

« first day (865 days earlier)      last day (4098 days later) »