« first day (834 days earlier)      last day (4114 days later) » 

1:00 PM
@Lusitanian now it's true
 
good mornings ;)
 
@NikiC :D
@hakre haven't slept since you last were here :O
 
@hakre morningsssss..
 
@Lusitanian Oh, that's quite some time ;)
 
@hakre lol
 
1:01 PM
@Lusitanian Because what Heroku tries to do in terms of helping you scale your application is already fundamentally simple in PHP. PHP is already designed to scale wide very easily. You just throw more servers behind your load balancer whenever you want to scale PHP up.
 
true
 
Heroku was primarily designed for the Ruby guys, because Ruby can't scale for shit.
And it's not any cheaper to pay for a few Rackspace/Amazon cloud servers to scale PHP up then it is to pay for Heroku, trust me.
I did about 645 hours worth of billable work for a client last year to move them from Heroku to Amazon.
They saved a boat load of money.
 
interesting
 
@Lusitanian When you think about Heroku's target market is really the developer that has no clue how to do sysadmin work. For that they have an added cost with the convenience of never worrying about the underlying infrastructure. The problem is when you application layer is in PHP (it's already made up of glue) and you find all the scenarios you thought were going to be simple just became a lot more complicated to solve on Heroku (because they need that sysadmin finesse).
 
Don
1:09 PM
Hello there phpers
Is this chat alive? or.. o-o'
Woot
Okay uhmm, I thought that I might be able to get some help from the pros here D:
 
@GoogleGuy I am the target market if you replace "no clue how" with "not enough time/too lazy to", etc
but I see what you're saying
 
@Don From the Room Description: "Discussion for all things PHP - You don't have to ask whether someone is here or can help. Just tell us your problem. If anybody can and wants to help, they will."
 
Don
Alrighty :3
 
@Lusitanian Yup, lazyness too has a price :)
 
Don
I have a website that's hosted under a shared hosting service, now I want to have multiple websites on this account. also, I wanted to allow users register to my site, redirect their domain to me, then let them use the php cms system that I made
Is it possible to do this by using htaccess & php?
 
1:14 PM
@GoogleGuy Though after fiddling with it for several hours, it seems a bit more troublesome than its worth.
 
@Lusitanian It can be. It depends on what you're trying to do. Like that client I had to migrate from Heroku grew their code base quite a bit over time and realized Heroku made their life miserable when they hired more competent devs that actually knew what they were doing.
If you are of the mindset that there is a one-size-fits-all solution to your hosting needs then Heroku works great for you. If you want a lot more control over your infrastructure and have very specific needs then it's likely not going to please you.
 
I'm working on object-based fork of OSCommerce. - what dou you think is best way to publish it and maybe get some helping hands?
 
Don
A simpler question, is it possible to manage .htaccess by using php? like, adding rules to it and such
 
@Don it is. But that is very very very (repeat some more time) unsafe.
 
@Don .htaccess is just another configuration file and PHP has no problem writing to files, so yes. However, I think you're going to find that what you're trying to do can not easily be done with .htaccess alone since most of what you're asking about involves DNS.
 
Don
1:19 PM
Fine with me
 
Especially not on a shared host.
 
Don
My idea was to have multiple folders, one folder for every domain
 
@GoogleGuy My problem is primarily spending the time to set up the infrastructure/easy deployment/etc
 
Don
Then when the root folder is accessed, have htaccess see what domain you used, and load files from the appropriate folder
 
@Lusitanian Time well spent, in my opinion.
 
1:20 PM
@GoogleGuy true
 
@Don You can't do this with .htaccess it's a runtime configuration. This requires root level access to apache's conf and DNS zone access.
 
Don
@GoogleGuy So htaccess cannot load files from.. /blablafolder and display it as if it was the root folder?
 
@Don what you could do is a single point of entry, like a "index.php" on you "clients" Server and a remote include from your Server. But this is dangerous, too.
 
@Don It can, but it has no bearing on virtualhost configurations.
 
on your* clients Server.
 
Don
1:24 PM
@GoogleGuy I don't really need any virtualhost configuration, I wanted to manage the whole thing by a simple php admin panel..
So when a user wants to redirect his domain to me, he just registers, (while registering it should add an htaccess rule)
So when my hosting is accessed through his domain, I want it to load the files from the folder I made for the user
 
@Don Well, I'm not sure what "the whole thing" is, but what you're looking for is called a rewrite rule. You're going to find that what you're asking isn't going to work out as you might expect. Good luck.
 
the request from the client is allways send to the server registered under the domain. You can't redirect that without chaning the domains DNS entry.
 
@ircmaxell: How is belgium?
 
Mornings
 
1:37 PM
@user2003255 Why don't you add your improvements to the main project then you already have helping hands.
@DaveRandom good morning!
 
@hakre Not sure about "good", hung over, haven't decided yet.
 
eat some fish. that normally helps.
 
I'm on chocolate at the moment, it's working well.
 
good idea, too.
 
@hakre Isn't that a bit NC/TL?
 
1:49 PM
@DaveRandom National Congress of Thai Labor?
 
Yes, yes that's exactly what I meant.
 
Thought so.
 
:-P
 
@DaveRandom Well it would be good to have a central point you can direct users to that have problems setting it up.
I see such questions from time to time.
 
@hakre bacause there so many changes that is more like a new project than just commiting some changes.
 
1:54 PM
@user2003255 so create a new github repo
 
@user2003255 Well rolling your own comes with a price. Forking is some work, do you have a public code-repository already, e.g. on Github?
 
@hakre Yeh true, but could probably do with rephrasing it somehow. As it is it seems like it's not a great fit for SO, not least because the question contains a partial answer. It needs to be edited to "Is there a list of things I can check / Yes here it is" IMO
Although even then it's kind of OT, it's not really a programming question, probably belongs on SU
 
@DaveRandom Yes, that sounds like a good idea / plan.
@DaveRandom Setting up programming tools is SO on-topic.
 
@hakre OK fair comment
 
good morning @webarto. -- ia600301.us.archive.org/2/items/…
 
2:00 PM
@hakre Grüß Gott :D LOL, had a jolly good laugh, although I don't einverstanden halb of it.
 
@hakre no... I guess this should be the first step ;)
 
@user2003255 Well if you don't share the code you don't find any potential users of it that are (potentially at least) willing to help.
 
@hakre but how big is the chance some find the code and likes it? i guess i have to some kind of advertising, too?
 
I am designing a joke's website.in this website a joke of the day come every day on main page from database and daily automatically change from database. what should i do?
 
@RahulGahlot Hire a developer.
 
2:11 PM
Ugh. Writing a parser when you're hungover is worse than when you're drunk.
 
@user2003255 yes, start with the README.md file, it's your homepage for the moment. You can later host a little website with github pages, but first polish the README.
3
Q: How can I run PHP script in certain interval (e.g. once a day)?

AdrianaI have a php script that reads one file through http(the file is on other domain). I would like to read this file only once or twice a day, instead of connecting to it every time the website is refreshed. Is there any other way than doing it with cron? I dont want to use cron cause I prefer to s...

@webarto I changed the DL location, you need to add .r783872 at the end of the path.
 
@hakre Where should I add it good Sir :)
 
after the o :)
 
@hakre Oh, missed that notification! Got it, muchas gracias compadre!
 
@webarto ah okay
 
2:48 PM
^ self duplicator (using multiple users ;))
 
3:00 PM
what's the best way check if a row exists... I don't want to compare each field
IF ROW EXISTS...
something like that
 
3:16 PM
@iroegbu Whats the meaning of your name ?
hi all
@webarto longest time
@hakre hi
 
hi @Baba
 
@hakre you can do better stackoverflow.com/a/13984860/1226894
2
A: Serialize or Hash a Closure in PHP

hakreYou could all that you need write your own, your own closures having a getId() or getHash() or whatever. Example (Demo): 1: Hello world 2: Hello world First closure (ID: 1), ID read in calling context. Second closure (ID: 2), ID read from within the closure (where self-reference). Code: <...

 
@Baba Enmity can't kill
 
@iroegbu interesting .. where are you from ?
 
Nigeria
 
3:19 PM
@iroegbu lagos , Abuja where ?
 
@Baba oh... State of origin: Abia... Living in Calabar for now
 
@iroegbu cool how was the Calabar Festival ?
 
@Baba shouldn't that answer just work? :)
 
@Baba massive... was so much fun!
 
@hakre still does not fix serialize issues
@iroegbu like to be there one day
 
3:23 PM
@Baba that will be cool, you could make it over this xmas for the Festival
 
@iroegbu cool
 
@Baba any idea on how I can check for existence of a row in mysql without having to compare fields? Is it even possible?
 
@iroegbu do you check for the row very often ?
 
@Baba ok... here it is... I built a forum and I want users to be able to subscribe to post I want to check if the user as subscribed to a post before letting the person subscribe so... I want to write a query to insert if the row already exist or do nothing if the row exists
 
@iroegbu SELECT EXISTS(SELECT * FROM table1 WHERE this = that )
@iroegbu .. i guess you are using MySQL so see dev.mysql.com/doc/refman/5.0/en/…
45
Q: Best way to test if a row exists in a MySQL table

Bernard ChenI'm trying to find out if a row exists in a table. Using MySQL, is it better to do a query like this: SELECT COUNT(*) AS total FROM table1 WHERE ... and check to see if the total is non-zero or is it better to do a query like this: SELECT * FROM table1 WHERE ... LIMIT 1 and check to see if ...

 
3:29 PM
@Baba ok... Thanks a million
 
@iroegbu you are welcome
 
@Baba uhm... wait, can I combine that with an INSERT
I want to insert if the row doesn't exist
 
@iroegbu depends .. Why not use INSERT IGNORE ?
 
@Baba hi baba how are you ?
long time no see
 
@iroegbu OR WHERE NOT EXISTS
@NullPointer please identify yourself :)
@NullPointer Pictured change ... can't identify user :)
 
3:36 PM
@Baba You can not serialize callables in PHP.
 
@hakre I guess OP is looking for a work around ....
 
@NullPointer lol ..... my main man ... :)
@hakre that still has minor issues with php 5.4
@hakre but it works
 
@Baba ohh ... now i can verify you are not victim of short term memory ..:P:P
 
3:39 PM
@Baba yes that is dirty shit :) - anyway OP writes that there is no persistence, hence I'd say there is no serialization then.
 
@hakre true .... i like your answer anyway +1
@NullPointer how are you doing
1 min everyone
BRB
 
3:55 PM
@Baba ok... thanks. Brb... Time to implement
@Baba where do you live
?
 
@Baba i am doing fine ...
 
Give poor Joe a few votes: stackoverflow.com/a/14548828/385378
The fact that PHP can do multithreading should get a bit further up in that question :)
4
 
4:22 PM
how would you put a php variable in pdo mysql query?
like "SELECT * from members WHERE id = $userid"
 
4:41 PM
Anyone here?
 
@DemCodeLines That's done with a prepared statement, see php.net/pdo.prepare
 
@hakre fatal error on the first line
	$result1 = $conn->prepare('SELECT * FROM `teams` WHERE num=?');
	$result1->execute(array($int));
 
/* Execute a prepared statement by passing an array of values */
$sql = 'SELECT name, colour, calories
    FROM fruit
    WHERE calories < :calories AND colour = :colour';
$sth = $dbh->prepare($sql, array(PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY));
$sth->execute(array(':calories' => 150, ':colour' => 'red'));
$red = $sth->fetchAll();
$sth->execute(array(':calories' => 175, ':colour' => 'yellow'));
$yellow = $sth->fetchAll();
 
5:00 PM
hello
 
@hakre i don't have an array of values. All I need to do is get information from a row by calling the id number associated with the row
 
5:49 PM
@NullPointer hey .. are you still there ?
 
6:14 PM
@Baba i am back master ....
 
@NullPointer Welcome back how was your exam
 
@Baba just secure my degree in honours
 
@NullPointer Congratulations
Hurry
 
thiankyou .....but degree in honours is more easier than php for me :D
 
@NullPointer lol
What next
 
6:19 PM
@Baba preparing for post graduation entrance exam ...
dont know its appropriate or not
 
@NullPointer i think its ok .....
best of luck bro
 
@Baba thankyou ....
:)
 
trying to answer a question ...
do you also want to give it a try
 
@Baba cool ....carry on ....
 
0
Q: Secure way to upload image in php and htaccess

airI have found following code on internet for secure image upload in php. I want to know it covers all possible way of attacks in image uploading. define('MAX_SIZE_EXCEDED', 101); define('UPLOAD_FAILED', 102); define('NO_UPLOAD', 103); define('NOT_IMAGE', 104); define('INVALID_IMAGE', 105); defin...

 
6:27 PM
@Baba cool bountied question ..
 
@NullPointer Do you think its secured ?
 
@Baba sorry i am working on database of a real state website but i tried
 
@NullPointer Oh ok :)
 
but i tried something like pastebin.com/U0wniLN4
it might be silly ... i always believe in white list to allow and black list to block ip or suspend that user
 
7:11 PM
@hakre holy shit. this is still happening?
 
7:35 PM
@tereško here? I wonder what does the $router->route($request); did? here in your answer stackoverflow.com/a/14047383/1328014
did it process the $request, then return it to the variable?
 
@JoeySalacHipolito write your question as comment on the answer
 
It seems route method fills the $request object with proper controller and method name.
 
how does php does that? call_user_func_array?
 
But IMHO all the route method should route the request. Means it should parse the request and invoke controller and method accordingly
@JoeySalacHipolito see php.net/call_user_func_array
 
7:43 PM
so I am right? that does that?
 
SRP leads to a lot of classes.
@JoeySalacHipolito about what?
 
about call_user_func, it fills the object..
 
It seem so. But I am not sure what Teresko meant
 
ahaha, okay, thanks anyway, it seems that I need to have a lot of mistakes first before getting it right.
 
@shiplu.mokadd.im no , it shouldnt
the route() method goes through the list of regular expressions, and, when a matching one is found, assigns the extracted values the the request instance
@shiplu.mokadd.im please stop telling people bullshit
router should never invoke controllers , it would be against the above mentioned SRP
 
7:57 PM
I am not telling bullshit.
Could you tell me why router would make request object? what do you mean by this request object.
 
who said that it makes anything ?
 
I know request means raw http request.
 
no, Request instance in that context is an abstraction for user input
 
Then call it something else. UserRequest or InputRequest etc
 
i am already calling it : Request
 
8:00 PM
Plain request is confusing
 
now you are just trying to find an excuse
@JoeySalacHipolito no, it does not
 
@tereško No. I am not trying to find an excuse. When I read it Request I though Its HTTP Request.
 
.. which was never mentioned
 
yes. But Request is generic term.
Making it a class name does not change anything.
 
8:04 PM
bingo
so instead you should have looked at how it was used
 
HTTPRequest or UserRequest are different. they make sense. Only Request doesn't
 
what the hell are you bitching about here ?
you answered a question that was aimed at me, you assumed that you know what i meant in that code and you were wrong
 
0
Q: MYSQL PHP Select

bushdiverHow do I select in this way: $sql_result = mysql_query("SELECT 1 FROM myTable WHERE myColumn = 'something' LIMIT 0,1"); if(is_resource($sql_result) && mysql_num_rows($sql_result) > 0 ){ // how do I select a row here? } like i would with this: $query = "SELECT * FROM myTable WHE...

 
what's RIGHT JOIN for? you can do the same with LEFT JOIN, doesn't matter which table is on "left"... I don't get it
 
Sure it's exactly the same thing...
 
8:12 PM
so where this can be used?
is it better to use right join than left join in some situations ?
 
@UchihaObito if table A and B is right joined the result would be (B-A)
 
It's all on the web
 
ok...
thx
 
@PeeHaa Ah thats what I meant. But this input does not accept SET characters!
 
8:29 PM
$sth = $pdo->prepare('SELECT * FROM awsome a LEFT JOIN funny f ON a.id=f.id WHERE a.id="5"');

returns exactly the same data as RIGHT JOIN. Should I see a difference or not?
 
 
1 hour later…
9:32 PM
Anybody know if PhpUnit test methods can start with something besides 'test'?
I swear I search for several minutes and then as soon as I say something I find what I'm looking for.
 
That is how things work.
 
The work around is not that pretty: you mark the docblock with @test.
This basically means that I have to add a docblock to most of my test methods if I don't want them to start with 'test'.
A few of them use @depends so they already have docblocks, but most don't.
 
 
1 hour later…
11:17 PM
@hakre ping
 
@DaveRandom pong
 
Yo yo
Is there any sensible/easy way to get DOM to throw exceptions in a meaningful way?
 
@hakre I just wrote an XML format with a DTD, I want DOM to throw an exception if the document does not conform instead of triggering errors, preferably without messing around with set_error_handler(), because I only want to apply it to the DOM.
Just wondering if there is anything I am missing in the libxml config funcs
 
you need to do that your own. this would be in the load function, enable internal errors, then check for errors after loading and throw your exception.
 
11:24 PM
:-(
Alright, no worries
That aspect of DOM really sucks IMO
 
Also, libxml_use_internal_errors() is really badly named, it seems to imply that by enabling it PHP would emit regular errors and disabled it to handle the errors yourself, but it's actually the other way around.
 
you can also use the option constant and disable the errors with the load function.
However I dunno how you can find out if the DTD is violated.
 
@hakre Presumably if you set $validateOnParse it would return false, but I'd like to get the messages as well. I'll just have to roll a quick error handler.
 
you do internal errors
and then you can get all errors with another function: libxml_get_errors
 
11:43 PM
Yeh I know that much :-P I wish you could just tell it to throw on error though, would make life so much easier.
 
@DaveRandom well exceptions don't work that well for multiple errors.
 
@hakre True, but tbh if you've violated the DTD I'm fine with just throwing on the first violation. Although I know what you're saying.
 
@RhymeGuy checked. take the existing answer, just remove /data() as this is not Xpath 1.0 which is used by PHP.
 
11:53 PM
@hakre thank you!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
you find xpath 1.0 here: w3.org/TR/xpath
 
Thank the lord! :D
 
thanks man!
 
I finally learned server administration enough that I'm cancelling with 1and1
parttyyyy :D they are shit.
 

« first day (834 days earlier)      last day (4114 days later) »