« first day (381 days earlier)      last day (4789 days later) » 
00:00 - 17:0017:00 - 00:00

00:00
@all hi. i have used recaptcha for my login page. now if somebody enters wrong words it shows echo msg on different page. but i want the text should be shown beside recaptcha n it wont allow to submit page until user puts correct words. how can i do that
<?php require_once('recaptchalib.php');
$privatekey = "key here ";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);


if (!$resp->is_valid) {
// What happens when the CAPTCHA was entered incorrectly
// die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
// "(reCAPTCHA said: " . $resp->error . ")");


}



else {

// Your code here to handle a successful verification }
}
anybody online?
@Filipe u online mate
?
 
7 hours later…
07:11
@sinni800 No, I am making a web scrapper that support file download.
@Filipe LOL, that's nice
user680786
07:44
Please, give me link, where can I find Doctrine DataMapper
user680786
see DBAL and ORM only
08:02
first of all , you should look at Doctrine 2
and it is an ORM
they are just trying to implement something in the traditions of DataMapper instead of going with ActiveRecord pattern
user680786
@tereško I saw their DBAL yesterday, and I can't understand, why they do need DBAL if DBAL is just implementation of PDO.
user680786
@tereško tell me please, is it worth to spend time on reading Doctrine2 documentation?
not sure
user680786
thanks
08:09
you might see some nice ideas for API
though i would not use it in a project , without some external reason
user680786
@tereško I have no forced reasons, I just looking something, where I can write my DB structure and use IDE autocomplete without copypasting names of tables fields.
sorry , i'm a fan of manual tuning
if by "write my DB structure" you mean that you want to let some other library to create your tables
user680786
@tereško no, of course
user680786
i mean write in some phpdoc comments, or inside php code
why not just write your own mappters
they will map the content of tables onto your own classes
user680786
08:17
@tereško laziness...
it's not like you should be using datamapper's API so much .. only fetch and store
0
Q: Loading Images on-demand (or; disable loading of hidden images)

Christian SciberrasI have a slider-like widget which is basically, a div of sub-divs containing some page content (together with images). Initially, all sub-divs are hidden except the main one. My problem is that all web browser seem to load (request) all images in the content, whether they're hidden or not. In ...

^ Help, help, help, pretty please!!
yui has some code for it
you should look it up , and try to reverse engineer it
user680786
09:00
with traits it will be more easy to write AR or DataMapper
user680786
"extends" word will not be necessary for them
09:20
@OZ_ yeah, a number of bad practises will be more easier then
user680786
@Gordon only bad?
@OZ_ i havent found too many situations where i would want to use a trait for good. maybe for iterator or for implementing array access, but apart from that?
user680786
@Gordon currently we need to extend base DataMapper class to get mapping methods, and create private fields as properties there. With traits we can just use DataMapper Trait and class can be extended in other branch of hierarchy.
@OZ_ extends datamapper from what?
user680786
@Gordon class BookmarkMapper extends DataMapper
09:25
usually datamapper doesnt extend anything but aggregates a modelfactory and tablegateway
user680786
@Gordon well, ok. So using Trait as tablegateway will be just more comfortable than aggregation.
@OZ_ no. that would be a design flaw imo
user680786
@Gordon well, maybe
user680786
can't judge without experience :)
yeah, hard to say right now. but i understand traits as generic reusable behaviors
09:29
2
Q: Heavy Javascript with URLs causes Chrome (DevTools?) to report bad 404's

Christian SciberrasA page containing a good load of javascript also contains URLs encoded within the javascript as JS strings. The problem is that Chrome (or perhaps just it's Developer Tools?) is trying to navigate to these encoded URLs as if they were a part of the HTML. This only seems to happen when there is ...

user680786
@Gordon I just hope they will completely remove ability to use properties from traits
^ Still needs answering...
@ChristianSciberras what do i have to do with that?
@Gordon @OZ types too fast :/ (answer: nothing)
@OZ_ imo that would be bad, because then you can only create traits that operate on properties of the classes that use it, e.g. the properties are depedendant on the classes
user680786
09:33
@Gordon well, if there will be properties which class can use, then it will real chaos
user680786
anyway, it's too early to say something smart now :)
@OZ_ yeah :)
@all Gud morning. we use $_post to get data from previous page to current page. But if we want to show msg from current page to previous page what we can do?
for example i have recaptcha and the testing file is next one which shows error msg. but i want to show error msg beside recaptcha
@mann I might need a time machine.
hahah
na serious mate, how we can do that
09:39
@mann you dont mean from current to previous. you mean from previous to next. put it into the session.
user680786
@mann really, you need the time machine
in simple terms i have recaptcha on signup page. but if somebody enters wrong words it shows error on error checking file. but i want to show on the same page beside recaptcha using php
1 message moved to bin
@Gordon why u moved that code ?
user680786
@mann just do that. On recaptcha page, check if error message is passed, and show that error message.
09:45
@mann because I already gave you the answer. Also, please do not post code here without using FixedFont.
on recaptcha page no error msg is passed
user680786
@mann so pass
user680786
or put it in the session
@Gordon Holla :)
user680786
and check in session
09:46
<div id="inquery" class="inqueryclass" >
<?php require_once('recaptchalib.php');
$publickey = "mykey"; // you got this from the signup page
echo recaptcha_get_html($publickey);
?>

</div> this is the code on recaptcha page
@Eugene hi
@mann Fixed Font please
@Gordon oh sorry mate
@Gordon Can I ask you a database type question, since @ircmaxell isn't here and I asked him yesterday evening that?
@Eugene sure can do
@Gordon Wanted to ask such question. If I have products in my application, that can have comments and then there are also news, that can have comments. So would it be logical to place all those comments in one table and later distinct them by some sort of ID or should those be separate tables?
user680786
09:49
@Eugene separate (I'm not Gordon or ircmaxell, but it's just my opinion :))
sessions are used to store login details about users. can we pass error msgs as well?
@Eugene depends. when you are sure the comment structure for news comments is always the same as the structure for product comments, then you could do that. dividing them into two tables might yield some performance benefit when fetching them though and allow for easier modification when the structures divert.
@Eugene can we store error msgs in session? like we user them for storing login details i think
yes i will thanks
09:53
> The session support allows you to register arbitrary numbers of variables to be preserved across requests.
@mann where are you from? which country?
@Gordon To simply put it, it's like global registry if I'm right.
@Gordon Thank you. I think it answers my question.
@Eugene hmm, come to think about it. you want to have them in two tables because of the foreign key
@Gordon Ou yes. I see now. For example if some news topic was removed, all comments linked to it, should be removed too. Same goes for product.
@Eugene if you put them into one table you need a compound key out of the foreign key for the item id and item type it is a comment for
@Gordon im from UK
09:58
@mann thanks
@Gordon wot happened mate.
why u asked
@mann was just curious
alright:-)
u were curious to know which country this dull programmer belongs to. hahah
@Eugene auto removal can be configured with cascading deletes. so when you delete a product, it will automatically remove all comments.
well mate i am iphone developer. this is the first time im touching php. thats why
10:01
@mann i didnt say you were dull, did I?
haha na i was just joking
@Gordon Well yes, but I guess you are correct about dividing that into to tables.
@Eugene cant really tell you what to do. both approaches would work from a technical point of view.
10:24
How do you do pagination and search in OOP? If I have 1000 items and I have an ItemMapper. Would it be a good solution to have $itemMapper->search($searchParams, $limitStart, $itemsReturned)?
10:35
@rickchristie feels ugly, doesnt it?
I'm feeling the object relational impedance right now.
I'm really really tempted to just dump the objects and have the queries return arrays
@rickchristie the alternative would be to always fetch all possible results and then only display a subset. you will want to use caching then of course to prevent getting all 1000 results each time.
hi everyone can I ask something about PHP on Mac, please?
@Gordon i set form action to another page. so login page will redirect to checking page and checking page actual checks error. so how can i redirect back to login page
because i want to show error on login page itself
user680786
10:39
@Tassisto just ask
@mann you will also want to search for "POST REDIRECT GET" pattern
ok thanks
11:36
GGood morning
@ircmaxell good morning!
12:00
do magic methods belong in an interface?
No
Except possibly __toString
12:24
Re-Asking: I am trying to download remote file using CURL and provide a progress, I tried this: pastebin.com/Dc7jKnWL, the download is running but nothing shown, any suggestion?
@ayublin Maybe it would be loggical to see what is in $data?
@ayublin you'll need an apachem odule, can't remember what it's called now
Do you guys indent using spaces or tabs?
user680786
@sinni800 tabs ftw
@sinni800 spaces
:D
12:27
I knew it :D
I myself am for tabs though
1 byte versus 4 or whatever the space count is
@sinni800 i dont care for byte count
@Gordon actually, me neither, but I regularly delete things by using backspace. This results in me hitting backspace four times or one time
@sinni800 use ctrl-del
@Gordon resulted in deletion of the whole line of spaces in netbeans
user680786
oh, really, useless arguing
12:29
Yeah it is, I only wanted to ask
@Eugene sorry, what do you mean?
And I kinda expected to get these diverse answers :P
@sinni800 the find the combo in your ide that does it right
@OZ_ yeah :)
@Gordon I set it to using tabs
@Burgi ohh, no clue at all?
12:30
@sinni800 i mean the combo for deleting
@Gordon I set it to using tabs. Problem was solved instantly :D
@sinni800 wait til you open that in an editor that uses 8 spaces for the tab or whenever there is a mixture of tabs and spaces ;)
@Gordon there's the worst thing about the discussion
Either you let the coder force upon you how the code you read is indented, or you risk using an editor that shows tabs as 10 spaces wide
@sinni800 use whatever suits your workflow. there really is no definite answer
@Gordon It's all "pick your poison". Subjective preference sucks when discussed
12:33
@ayublin nope, sorry. just saw it popping up as a notice in a drupal project. google might help?
@Burgi okay, I will try, thanks
:1781761 but congratulations for proving Godwin's Law ;)
lol
@Gordon I seem to always do. I am so German
Therefore I am a nazi, but that's a completely different discussion
Let me reword my comparison though
It's like trying to prove that placebo medicine A that you take works better than placebo B that he takes
Because both are subjective :P
People might choose A just because it looks better than B. As Coke/Pepsi found out :P
or vice versa
user680786
12:39
so in short:
People might choose
@Burgi For curl? He should probably place error_reporing and display_errorsfirst. Since as I recall if you haven't got some module PHP will tell it to you.
@Burgi I forgot to tell you, I tried to place echo $data like this:
function callback($download_size, $downloaded, $upload_size, $uploaded) {
	echo $downloaded;
	echo $data;
	flush();
	ob_flush();
}
ehh, no I mean like this:
function callback($download_size, $downloaded, $upload_size, $uploaded) {
	echo $data;
	echo $downloaded;
	flush();
	ob_flush();
}
@ayublin Where from do you get $data inside a function?
@Eugene I just stupidly trying it, but I got error message, and the $downloaded printed like this:
Notice: Undefined variable: data in D:\web\htdocs\learning\index.php on line 6
0
Notice: Undefined variable: data in D:\web\htdocs\learning\index.php on line 6
26
Notice: Undefined variable: data in D:\web\htdocs\learning\index.php on line 6
154
Notice: Undefined variable: data in D:\web\htdocs\learning\index.php on line 6
282
@ayublin Of course it did.
12:46
@sinni800 Yes, but finally the downloaded showing, without the error it won't print anything
@ayublin Still, remove the echo $data part, it's nonsense.
@sinni800 Yes, of course, haha.
@ayublin use the UP arrow to edit your last chat message. It's very useful!
@sinni800 removed, thanks
@ayublin What are you trying to do?
@ayublin What are you downloading?
12:53
I am trying to download remote file using CURL and provide a progress, I tried this: pastebin.com/Dc7jKnWL
@sinni800 please look at the pastebin
@ayublin okay. It's pretty crazy how you have to bend things using php :D
@ayublin Does curl_exec block the script as long as curl is running?
Hi guys
@ayublin Wait, yeah it does
@sinni800 I guess so, the browser loading running
Does anybody know about how to install PHP 5.3 at Suse 11?
12:58
@ayublin okay.. Try with a smaller file. When the download finishes, does the progress get shown
@sinni800 okay, but I think it's strange if we can't call or get the result of the callback
curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, 'callback');
@ayublin It might be a response caching issue then
because from the name, it's should give us information about the progress
@ayublin if nothing works, you could try multi_curl
@sinni800 okay I will google multi_curl too, thanks
13:04
@ayublin the difference with multi_curl is that the call does not block your execution context
You will have to keep alive your context yourself
@ayublin multi_curl does not have a mechanism to track progress so you will have to do it with the callback again!
@sinni800 wow cool, thanks a lot.
@ayublin I mean, you can use multi_curl but you will still have to register the callback with multi_curl
@sinni800 ohhh, so my business with "callback" hasn't over yet.. haha
@ayublin holy shit. I tried your code and it works
@sinni800 holy wow! the same code? what browser?
13:11
@ayublin chrome.
@sinni800 hmm, I use chrome too
@ayublin It echoes the file content
@sinni800 wowwww
@sinni800 it's echoed the content and bytes downloaded
@sinni800 is it because I use windows?
@ayublin I use windows too..
@sinni800 I don't know this is a good or bad news..
13:15
@ayublin Try again... It endlessly reports the progress. Awesome
How inappropriate. ReflectionMethod::getPrototype throws an Exception when there is no protoype.
@sinni800 wow, are you echoing the $download_size ?
echo "$downloaded / $download_size <br />";
@ayublin look at it now... it works
@sinni800 cool!
@ayublin seems like your environment is not sane for some reason
13:22
@sinni800 I am using xampp, arghh this is crazy :(
@sinni800 wowww, mine is working too actually
@ayublin lol what
@ayublin do you want to transfer files for your own use with it?
@sinni800 apparently, it's printed horizontally, and they are hidden far away..
@ayublin crazy
@sinni800 yes, that's a free game, it's even free to publish
@sinni800 thanks again sinni :D
@ayublin well for file transfers I have something awesome
13:32
@sinni800 powershell ?
@ayublin yeah, I said so yesterday :D
@sinni800 Yes, you said it, I even get a picture of powershell :D
@sinni800 how to do it with powershell actually?
@ayublin These are the commands:
import-module bitstransfer
start-bitstransfer -source source.url -destination d:\destination.file -asynchronous
wait
@sinni800 okay, I have had my powershell opened. haha.
wait this does it in foreground of the powershell
get-command -module bitstransfer
Gives you all commands bitstransfer has
start-bitstransfer -source source.url -destination d:\destination.file -suspended
13:38
@sinni800 cool, i tried the commands
but the JobState keep showing connecting
You can also do
$transfer = start-bitstransfer -source source.url -destination d:\destination.file -suspended
then $transfer will contain the transfer data
and resume-bitstransfer $transferwill start the download
@sinni800 wow, it can do that much
$transfer.BytesTotal contains the file size
$transfer.BytesTransferred contains the data transfered up until now
For example you can type 100 / $transfer.BytesTotal * $transfer.BytesTransferred to get the current percentage
get-bitstransfer gets all the current transfers
to finalize a transfer when it has reached 100 % type complete-bitstransfer $transfer
Wait, you need to do resume-bitstransfer $transfer -asynchronous to resume one in background
Yeah, it's a whole world of stuff..
@sinni800 cool ! this far I only used powershell to create user, OU, and etc in a lecture. haha.
@sinni800 btw, I run the start-bitstransfer -source source.url -destination d:\destination.file -asynchronous
but didn't assign it to anything
the job state shows transferred, but the file doesn't exist
14:03
@Gordon - Is it appropriate for controllers/views to access data source (e.g. table data gateway, table module) classes directly? Say to get a result of a query?
@rickchristie not if that means putting the query logic into the controller or view. you may call on the public api of the model but should not put logic of it into V or C.
Good morning again
@ircmaxell - Morning!
how goes it
I'm trying to wrap my head around designing a good domain model
@Gordon - yup, thanks :)
14:06
@rickchristie np
OO design is hard
@rickchristie not at all
@rickchristie amen to that
@ircmaxell i disagree with that
@Gordon look what i made that reply to
I said not at all to the "is it appropriate" question
I agree 100% that OO Design is hard
@Gordon Ok, I'm listening...
@ircmaxell fixed :)
14:09
:-D
It is important to draw a distinction between the Data, and the Database. The data is an asset. The database is a tool and a detail.
@ircmaxell i understood that @rickchristie wants to do something like $model->query('SELECT blah') in either controller or view and that would be inacceptable. whereas hiding that query behind a method and calling it then is okay.
The database or any details about it should never leak to the Controller or View. They should be abstracted in the model (preferrably very deep)
oh wait. you said its not appropriate. which is what is said too
debating what we agree on is pointless i guess
user680786
lol
.oO(must work on reading comprehension)
nvm :)
14:13
@Gordon correct
but the api should not be dependent upon a query or the like. It should represent a data domain. The details of which may be extracted from a query, but that should be only coincidental
how do i combine the filter options for docs.php.net/manual/en/reflectionclass.getmethods.php? for some reason they wont work when i try to bitwise them. i always get an empty array
@ayublin do $transfer = get-bitstransfer
@ayublin and then complete-bitstransfer $transfer
OR @ayublin, get-bitstransfer | complete-bitstransfer
hrm, an array perhaps? or concatonation?
since it's defined as string $filter I would try concatonation
@ircmaxell - so the API should be at the form of questions we would like to ask, right?
hmm, i think i did something else wrong
14:23
@Gordon | them, as usual
@rickchristie In a sense... More of the data that you expect back
@salathe thx
So let me confirm this. If you have complex business logic, create a domain model object to encapsulate it. Otherwise, just use a table module/table data gateway's insert/update/delete methods.
No. Always create a domain model object
@ircmaxell - even if the domain model object does not have any logic whatsoever other than getters and setters?
14:28
@sinni800 thanks
then use a data mapper below that object to CRUD it. Nothing outside the model should ever interact directly with anything that has SQL in it. It tightly couples the application to the database. Whereas if you keep it below that, you can swap out the database for anything else (REST, Memcached, etc) without affecting or being limited by anything else...
@rickchristie it depends. pick a domain logic pattern that best fits to your application. then pick a data source architectural pattern that fits the domain logic pattern. but basically yes.
and without having to rewrite your business logic (since the data mapper is just limited to CRUD (and doing more complex queries)
MVC is a delivery mechanism, not an application architecture.
i think i wouldnt call it a delivery mechanism but i fully agree to not an application architecture
@Gordon Disagree with that. It's not an application architecture, but it's part of one. And it's not a delivery mechanism at all... Not that I can see at least...
14:35
Fowler calls it a Web Presentation Pattern, which i think is somewhat misnamed either
I think just Presentation Pattern would be okay
bob is tweetative today
Huh? I disagree even more now with that statement
@ircmaxell to me MVC is nothing but an organizational detail. and given that two letters of the MVC are about presentation, I guess presentation pattern is fine.
Is it allowable for data mappers to have methods that doesn't return domain model objects? Methods like $bookMapper->getTotalBookCount()?
But presentation pattern implies that it's just on the presentation layer. And it's deeper than that. In fact, I would argue that since it forces the application into three distinct roles, it can't be a presentational pattern...
4
A: Password Encryption Method? : PASSWORD() versus md5?

Hans EngelSee the MySQL docs for PASSWORD: The PASSWORD() function is used by the authentication system in MySQL Server; you should not use it in your own applications. For that purpose, consider MD5() or SHA2() instead. Also see RFC 2195, section 2 (Challenge-Response Authentication Mechanism (C...

hello everybody
@rickchristie i dont see why it shouldnt. alternative would be to return an empty BooksCollection and count that instead.
@ircmaxell cant find a more fitting name
@rickchristie I'm not sure. I don't feel comfortable exposing the mapper to the controller or view. But I also don't see how to cleanly expose that without a domain object. Perhaps @Gordon's suggestion of a BooksCollection is appropriate
@Gordon Call it for what it is: a design pattern.
@ircmaxell Organizational Pattern would be okay as well, but that bears the question what it organizes
@ircmaxell yeah i guess MVC is just MVC
Like all design patterns, they have a role in architecture, but they aren't an architecture by them selves.
@ircmaxell - If you don't expose the mapper to the controller, how do you get the domain objects in the first place?
or am I having a wrong understanding of things.
14:48
0
Q: Data Mapper: An domain object should never call its data mapper?

openfrogI'm reading Martin Fowler's Book about enterprise application architecture design patterns, but the German version. So, in my book on page 193 (in case you have it), he writes in German that a domain object (an object of the business logic layer) should not be depending on their Data Mapper. So w...

@ircmaxell that doesnt answer @rick's question though. why should a controller not call the mapper?
because you should be using a layer between them. A domain object factory perhaps
@ircmaxell the domainobjectfactory is inside the mapper
eih
disagree but not focused enough right now to figure out why
disagree in that it feels wrong to have the data mapper accessed directly outside the model...
my understanding is that data mappers act as factories for domain objects.
14:53
Not quite. They map domain objects to persistent (or not) storage
and in that process instantiates domain objects, right?
One role is to create the domain objects (possibly, you could also just populate one that's passed in), but it's also responsible for saving them and deleting them...
@rickchristie you might want to look into Repository
@rickchristie Possibly. Possibly not
ive checked POEAA and i dont see anything that is related to creating new domain objects. at least none that are not mapped from the db. that would be repository then.
done
I love the comments on that password "encryption" question I linked to
is there any pretty way to negate a FilterIterator?
15:35
@Gordon make a new one
@salathe that would be the unpretty way :) but i cant think of any other short of allowing a $negate flag as an additional argument. which isnt pretty either.
add some flags to your filter iterator?
yesh
MyFilter::STARTS_WITH_A | MyFilter::NEGATE :-)
Is there a mssql function that turns "2011-10-25 00:00:00.000" into "25/10/2011" ?
Or php, I'd rather do it in the query however.
@salathe i guess what i am really looking for is a FilterChain
@Gordon hmm, if only someone had written a filter chain example somewhere...
15:39
I've attempted

convert(
datetime
,"2011-10-25 00:00:00.000"
,103)

Without success.
@Gordon Have you some experience with Twig?
@salathe $fc = new FilterChain; $fc->addFilter(new Not(new FooBarFilter));
@Eugene none
@salathe or rather ValidatorChain. not sure what it is.
@Gordon Darn.
@Gordon Maybe @ircmaxell?
head explodes
0
Q: How to effectively slice tabular data using data mapper and domain model?

rickchristieLet's say I have two tables: Book and Category. Book has a foreign key to Category. Book can only have on category. Let's say I want to display this table: Book Title | Category ID | Category Name ------------------------------------------------------------------------- Lord o...

I'm off to bed. C'ya guys. Thanks for all the help :D
c'ya
is that possible to do this: a button trigger an ajax calling a php process, and the php send response of the process in certain interval, and the javascript keep receiving the response and manipulate the dom to show progress.
16:21
@ayublin I dont know. You might need a WebSocket
@ayublin I think the XHR only gives you the final response, not a stream which you can get while the response is being retrieved
@sinni800 ohh, yes I tried and only able to get the final response, I am wondering is the mechanism similiar to ajax uploader with progress bar like this: valums.com/ajax-upload ?
@ayublin No, not at all.
@sinni800 it's said that they are using iframe, I see the code, but to complex for current me.
@sinni800 ohhhh
@ayublin What you can do: Have a temporary text file which saves the progress
@ayublin While script #1 runs the download and saves the progress to the text file regularly, script #2 refreshes every second and reads from the progress file
@ayublin That seems like one of the only ways to me. Internet Explorer seems to be able to get the response stream from an XHR directly, but that is in the ActiveX XHR, which is not available in any of the other browsers
@ayublin Or use a proper environment like Java and .NET so you can let the web request run between client requests (and not make it die when a request ends like in PHP) and just get it's progress sometime
@ayublin or, 3rd, run a seperate PHP script not tied to the client request (run php.exe with the script) which downloads and updates the text file like in way #1... There's forms of IPC which could do this too but... yeah
@sinni800 Ohhh I see, the #1 method sounds good to me, for the #3 what is IPC?
16:33
Inter-Process-Communication
I don't even know if this is worth it
@sinni800 okay, thanks a lot, so many thing goes into my head today XD I will try your suggestion start from websocket and #1 :D
hello all... anyone for a little help with drupal 7 + oracle?
I've tried reading the OCI / PHP stuff as stated in stackoverflow.com/questions/6607994/… but can't make it work on windows
anyone ever tried that?
00:00 - 17:0017:00 - 00:00

« first day (381 days earlier)      last day (4789 days later) »