logs archiveIRC Archive / Freenode / #php / 2015 / September / 3 / 6
morphyeys
OMG
thank you very much guys omg :X
Alphos
morphyeys don't forget to set the appropriate optional args for htmlspecialchars/htmlentities
morphyeys
optional args?
what do you mean?
Alphos
!+htmlspecialchars
php-bot
string htmlspecialchars(string string [, int quote_style[, string charset[, bool double_encode]]]) - Convert special characters to HTML entities - http://php.net/htmlspecialchars
Alphos
!+htmlentities
php-bot
string htmlentities(string string [, int quote_style[, string charset[, bool double_encode]]]) - Convert all applicable characters to HTML entities - http://php.net/htmlentities
Alphos
see the args that are between [] ?
they're optional, meaning you don't need to fill them for the function to operate
but you definitely should fill them for it to operate the proper way to suit your needs
morphyeys
ahh okay
         

Alphos
the quote style and charset are especially important
morphyeys
thank you very much man!!!!
I am going to learn and try to use Laravel soon I don't know if it's a good idea
but Laravel will be doing that form e
for me*
Alphos
when it comes to frameworks, whatever floats your boat
morphyeys
okay
fritz4fun
How to create more connections to a server that allows only 10 http connections? Any ideas or suggestions would be highly appreciated.
FrEaKmAn_
if I have an xml object http://pastie.org/10393649
how can I rename var to data OR even remove it (to have directly array)?
biberu
FrEaKmAn_: reassign it, but if you are simply querying the document for information you should probably look at xpath instead. also you should avoid simplexml, it's not simple at all.
fritz4fun
Anybody experience with HTTP Pipelining?
Bittarman
fritz4fun, thats probably actually your browser limiting it.
fritz4fun, state what you want to achieve with this and someone might have a more appropriate suggestion for you.
fritz4fun
looking for some workaround suggestions if a server allows only 20 simultaneous http connections. the limit has been set by the server adiministator.
adsc
maybe websockets?
fritz4fun
adsc: thanks.
TCP is the underlying protocol and is not limited. Would it be possible to create 100-200 tcp connections and sending multiple http requests over them to the server. Is this called http pipeling or is it something else?
adsc
TCP is layer 4, HTTP is layer 5+
HTTP is TCP, too
fleetfox
use http2
Bittarman
fritz4fun, pipelineing is using the same connection for multiple requests without waiting for the repsonse... like spdy or http2 implement.
bongjovi
Is there any way to optimize this? http://pastebin.com/ZYiDESZA
Bittarman
as for a server not supporting it... well http doesn't make connections, they're tcp connections, and theres little you can do if the other end is limiting it.
bongjovi
Like calling date twice for example and extracting the three variables that way
Alphos
bongjovi why do you have start day, start month, and start year, instead of start date ?
date('Y-m-d', $start_date) would give you an ISO-formatted date for your start timestamp
bongjovi
Alphos: I'll paste the whole function
http://pastebin.com/Y8p32QyD
pretty ugly eh
Basically only returns a date string that is relevant, so only shows the year once if both start and end dates are in the same year for example
same goes for month and day
         

Alphos
can't think of any better way then, sorry
bongjovi
No problem, just wondered if there was a way to extract j F and Y as separate variables whilst calling date only once
Alphos
you can always explode
bongjovi
yeah I did consider that, I wondered if it would be faster
I'll try that
Alphos
if it is, it's only going to be marginal compared to your entire script
bongjovi
yeah, just trying to see where I can optimize, that function is called about 100 times
xep
bongjovi: DRY. Don't Repeat Yourself
you have branches to accomplish different formatting, but each one has stuff in common
everything starts with $start_month and $start_day, that can be factored out
Alphos
xep he's comparing start_month and start_day separately, there's no point in merging them
lost123
hi i am solving some programming tests again, can somebody optimize my solution? https://codility.com/demo/results/demoAXM5EB-65F/
xep
ohai
you were so grateful last time, why not
lost123
xep : )
i am performing better today yay!
xep
learning is good :)
lost123
yesterday i failed most of them, but today i am doing much better
yep, i believe so.
bongjovi
xep, that makes sense
thanks
Agen_Terminator
Hi guys. Does anyone know how websites like Rightmove, Zoopla and Zillow have enquiry forms without a captcha, but also without spamming their clients? Are they checking for cookie acceptance, or js mouse tracking, etc., or what?
Alphos
Agen_Terminator ask them
xep
so you have a case of nested for-loops again
lost123
xep: yep, but couldn't find a way to do it in a better way
fleetfox
Agen_Terminator: check for js enabled, not bots doesn't run js
most*
Bittarman
Agen_Terminator, lots of small pieces make up the whole there, they use filtering services, like akismet, ip reputation services (to spot botnets), and more.
Agen_Terminator
I think that'll probably be it too I'm going to test in Lynx
Bittarman
they don't rely on something to be honest about whether it has javascript :)
Agen_Terminator
Fair enough. I don't think it'll be as simple as just js checking - as obviously things like noscript will exist.
fleetfox
if you are targeted you are fu*ked anyways
AmirHossein
Hi friends, I have a question. Whats best way to know mysql_query return not false? !=false or !==false?
Elirips
With MySQLi, there is no need for something like 'mysql_free_result', do I get this right?
fleetfox
best way is to not use mysql_
AmirHossein
i use mysqli
but i want do something if mysqli_query is not false.... else do something...
Gatomon
(Action) likes using PDO to connect to mysql.
lost123
hi i am solving some programming tests again, can somebody optimize my solution? https://codility.com/demo/results/demoAXM5EB-65F/
AmirHossein
i use Procedural style
Gatomon
AmirHossein, you can learn something different. ;0
Bittarman
AmirHossein, you can still use object procedurally.
AmirHossein
yes, but now can not use...
Gatomon
Yeah. Procedural and Object orientated programming.
AmirHossein
just help me whats best way? !=false or !==false?
Gatomon
AmirHossein, you can do booth.
Bittarman
!== false
Alphos
Gatomon : john wilkes ?
biberu
you should know the type, and if you know the type you should *always* use ===/!==
AmirHossein
but if query return empty?
Bittarman
always strict unless you explicitly need it to be loose.
biberu
don't mix return types
Bittarman
AmirHossein, !+empty
php-bot
AmirHossein, bool empty ( mixed $var ) - Determine whether a variable is considered to be empty. http://php.net/empty
Gatomon
AmirHossein, it is not too late. :+)
« prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 next »