« first day (1563 days earlier)      last day (3368 days later) » 

1:25 AM
My new side project
 
1:36 AM
I'm wondering… why aren't there optional methods in interfaces, which you can specify (if you do, you must match the signature), but don't have to. If called and not implemented, it just would have no effect.
 
1:59 AM
@bwoebi use an abstract class?
 
@AndreaFaulds I cannot extend two abstract classes, so no.
 
@bwoebi Make two interfaces if some aspect is optional
 
@AndreaFaulds If three aspects are optional we'll end up with 4 interfaces.
(at least)
no, thanks.
 
What's so bad about that?
 
It's spamming interfaces for no reason.
 
2:01 AM
if you have that much optional stuff, you probably should have several interfaces
 
@AndreaFaulds It's stuff like onStart() onStop().
 
Sounds like a good idea for an interface.
Three small interfaces > one massive interface
 
And I definitely won't make StartableWebsocket, StoppableWebsocket and then StartAndStoppableWebsocket
 
Why three?
 
what why three?
yeah, the last one isn't necessary
 
2:04 AM
Why not just StartStoppableWebsocket, or StartableWebsocket and StoppableWebsocket?
:/
anyway. night.
 
They all would have a method…
one single…
 
 
1 hour later…
3:32 AM
hummmm :/
never thought this would work:
function function_fixture(){
    function test(){ echo __FUNCTION__, PHP_EOL; }

    echo __FUNCTION__, PHP_EOL;
    test();
}
function_fixture();
var_dump(function_exists('test'));
 
Uh… isset(CONSTANT["key"]) fails with a fatal :s
 
global function inception 3v4l.org/mTKRP !!!
 
yeah… PHP…
 
@bwoebi I expected a syntax error (no error), then I expected at least to have a "local function" but... apparently we can declare functions withing functions and they will be available on current namespace (all global in the example)
hope this was "planned" :)
 
It's so that you theoretically can conditionally define (global) functions inside functions.
Great, no?
 
3:49 AM
I'd prefer to have local functions inside functions so we could defer function calls inside functions that have different implementation of functions... damn <3 PHP
Global function inception http://3v4l.org/mTKRP because #php
 
4:48 AM
morning
 
4:59 AM
morning
 
@RonniSkansing morning
 
user895378
@RonniSkansing morning
 
user895378
@RonniSkansing First day on the new job?
 
=] Nope, next monday, so this week is chill time
 
you got another new job?
 
5:12 AM
yea.. I got that teaching job, and shortly after I got a dev job
 
user895378
@RonniSkansing even better!
 
yea, and it is at a company which I am glad/proud to work at
 
so I am pretty happy and abit nervous about starting =]
Job inteview was all talking about solid, which was cool, instead of horrid personality tests
pay is good, lots of benefits, I just hope I blend in [=
 
 
1 hour later…
6:33 AM
0
Q: How can I tell if my PHP application has become sentient?

Tim Post's Sock DrawerI've written a fairly extensive application using PHP and lately, I'm concerned that it might have become sentient. Just last night as I was about to run a build and the test suite, the socket server sent this message, which I caught in my browser's console: No, don't - you know that's not go...

4
 
7:25 AM
good morning
 
posted on January 26, 2015 by kbironneau

/* by raknarrok */

 
morning
 
7:41 AM
moinz
 
8:05 AM
@Jimbo that transactions for reading thing made me think i didn't know nothing about it, so i asked it on SO stackoverflow.com/questions/28146425 if you are interested :P
morning all
 
E_TOO_MONDAY
 
morning
 
8:24 AM
Why do people on SO think that they'll get answers on shitty questions just because they have avatars with hot chicks on it? I mean c'mon. We're programmers...
 
can someone tell what does constant time implementation of some functions mean here
morning
 
@SergeyTelshevsky I believe it means that you will not be able to define functions at runtime.
(For example, when you define a function within a function)
 
@SecondRikudo like this one by any chance?
 
@JecebahnYaledimacOndestal if you need a read-only table, you should set it in user's permissions
 
@SergeyTelshevsky Yes
 
8:28 AM
as in: don't grant INSERT/UPDATE/DELETE on taht table
 
The test function is not defined until function_fixture() is called once
And if function_fixture() were to be called again, you'd get a fatal error (because test is already defined)
 
@tereško that's not really the point :P
 
@JecebahnYaledimacOndestal I have not had my morning tea yet
 
maybe question wasn't clear
 
8:29 AM
@SecondRikudo what does this mean? they are internal afaik?
 
@JecebahnYaledimacOndestal managed to read once more
it seems that transaction is the proper solution
 
added: "how do I guarantee that involved rows don't get changed by someone else between the two selects?"
@tereško transactions don't lock rows automatically, at least not using REPEATABLE READ
 
transactions make sure that you do not get race conditions
which is exactly what you are looking for
 
not always. that happens only if you use the SERIALIZABLE isolation level, which isn't standard sql iirc
 
@SecondRikudo this doesn't have anything to do with defining functions at run time, see tonyarcieri.com/… for context
 
8:35 AM
transactions don't cover any race condition, as in my example which is very common, you need explicit locks
 
error setting certificate verify locations: CAfile: C:\cacert.pem CApath: none
I had it in the PHP folder first but same error. Should have all the necessary permissions. Does anyone have an idea? I guess that's what you get for using IIS... :x
 
basically my example is a case of a phantom read
which isn't prevented by default by REPEATABLE READ
 
good meurning!
 
morning
anyway no, serializable is standard sql. didn't know that
 
E_MONRING
 
8:56 AM
0
Q: What is the way to create a whois lookup with extension "vn"

ptvivanI have the PHP code: $domains = array( '.com' => array('whois.crsnic.net', 'No match for'), '.info' => array('whois.afilias.net', 'NOT FOUND'), '.net' => array('whois.crsnic.net', 'No match for'), '.org' => array('whois.pir.org', 'NOT FOUND') ); And I need to add extension ".vn" in this ...

... wat
 
marning
 
@Gordon oh you understood what he meant...
 
lol
morning
 
9:16 AM
@FlorianMargaine not necessarily. I assume he has a script which does whois queries against whois providers
 
@Gordon just say "yeah I'm a god"
 
@FlorianMargaine are you Gozer the Gozerian?
 
@FlorianMargaine in that case, Yes! I AM a bonafide god.
 
mornig
 
9:22 AM
'nin
 
@Gordon from the perspective of cave-dwelling sheep-herders, we all are "gods"
 
@tereško there was not much choice given that @FlorianMargaine is Gozer
 
posted on January 26, 2015 by kbironneau

/* by KraHen */

 
9:41 AM
 
10:17 AM
Aaaah fuck reddit
"This code isn't production-ready: it needs validation and sanitisation."
No it fucking doesn't
It's an email. Email is plaintext. There is no escaping you need to do which PHP/sendmail isn't doing for you
The subject and body can't be "validated", it's a free-form text field.
The email address? You can't validate that sensibly, nor should you
And "sanitisation" o.O
 
@AndreaFaulds headers
 
@PeeHaa It doesn't have any headers.
 
ah
 
The one thing I can see being a problem is if mail() doesn't do its job and lets you use "foo@\r\nexample.com" as an email address
 
@AndreaFaulds Nope. Not a problem afaict
There has been an issue like that iirc but it has been fixed years ago
 
10:23 AM
However it's probably doing its job and escaping that
Ah, good
 
Header injection for all fields except the headers string (sorta) has been fixed
The only reason for sorta is that there are some checks for malformed headers which will prevent some
@AndreaFaulds link?
 
I was always wonder - if reddit is such a bunch of sh*t, then why read it? I have no account there and tried to look into there only once - to decide that I had enough and don't want to see it more (:
Good morning
 
@FlorianMargaine Reddit's cache isn't updating, I can't see your comments or even my own
 
@AlmaDo /r/php is bad, but many subreddits are useful
@AndreaFaulds damn
 
10:28 AM
@AlmaDo it's addictive
 
oh, same with me.
 
I responded twice saying there's nothing you really need to validate
 
git commit -a -m "Fixing everything" sigh
 
git push -f origin master:
 
10:31 AM
@AlmaDo You can combine -am :-P
 
@DejanMarjanovic habbit
 
happened a month ago or so :D
 
Better, because you don't want to always commit all files @AlmaDo
 
@ThomasDavidPlat git rebase -i HEAD~50
 
10:32 AM
Friday it was git commit -m "Lucky round of shots"
 
squash x49
 
@FlorianMargaine :D
 
@Achrome You mean git yolo ? :-P
 
YOLO!
I will someday kill a repo with that
 
yesterday was -m "A gratuitous amount of scaffolding for a project with two functions." ...added unit tests, code sniffer, phpmd, travis, scrutinizer, composer... and likely other things now forgotten
for like ~30 LOC
 
10:36 AM
* a4ef5af Centering is damn hard
* afd6d54 Even more centering
* 54f1899 More centering
* fc2997e Centering the form
Can't beat that
That was shortly followed by this
* d07df55 z-index, thou art a pain in the buttocks
 
-m "Another bug bites the dust"
 
@Achrome Good thing you can squash commits :P
 
@PeeHaa It's a private repo, so the number of commits don't matter at all.
I'm the only active dev in my company for some time now
 
Replied
 
4abd1e2 bug511
7e804fa bug 511
a9a8f67 update for #bug 511
looking at some work project...
 
10:41 AM
* 498b34a Damn you Safari
@FlorianMargaine That's awesome
 
ThW
Morning
 
Good Morning everyone :)
First day as PHP developer trainee at an IT company :)
 
First day doing training, and you're in a non-company chat room?
 
@ircmaxell SO is always open, I am initializing something so ye :)
Got nothing much to do atm. behave initializing this.
 
10:45 AM
@SergeyTelshevsky lol
 
also figuring out how webmin works.
 
Just messing
 
hehe happy mondays =]
 
/me is sitting on a plane again
 
@ircmaxell oh messing with the newbie right? XD
 
10:47 AM
:| As soon as I'm working at the new company in april I'll shed a tear. Guess I won't be allowed to hang around in room11. That makes me sad even now :(
 
@ThomasDavidPlat We don't leave don't worry
 
At least I'll get a > 9000 productivity boost
 
@ThomasDavidPlat Allowed? Pfffft.
What has that got to do with "productivity"?
 
What should I build on the plane?
 
@DejanMarjanovic reading and writing chat messages and shit
 
10:51 AM
@ThomasDavidPlat Well I am better developer and human 'cause of it :-P
 
@ircmaxell hopefully nothing that will make it crash
 
Especially @ircmaxell's slaps on the wrist.
 
@ircmaxell a large red timer that counts down
 
@ircmaxell Your message ends with 666 so build something beasty.
 
Wow, you lot are morbid
Especially since I am taking off into a storm
 
10:53 AM
lol
 
Thanks
 
@ircmaxell linux kernel?
or google chrome
 
Well you're not flying with Asian airlines. @ircmaxell
 
Maybe a generator that prints a random quote in Arabic with 6em?
 
10:55 AM
lol stop it.. =]
You are all too funny.. Can not focus... lol... bbl
 
okay guess that was too much
 
@ircmaxell Another PHP framework
 
11:12 AM
huh, docker is so cool (:
 
@AlmaDo I ditched docker
I just use lxc now
the all-the-time-overlayfs way of docker isn't really suited for me...
 
nah.. docker pull and just set that to puppet provision, and everything works on fire, without bitching around *:
 
lxc can do that too...
:P
 
well, I have 3 layers.. memcache->solr->mysql , though..
 
MSM
Sounds like a drug
 
11:17 AM
most acronyms sound like drugs
 
"Yo Dawg, you got some of that php for me, innit? Gotta have my fix"
 
alright, let's do some work (:
 
woo
Hello guys!
Does anybody know correct (keeping in mind [this fact](https://reprog.wordpress.com/2010/04/19/are-you-one-of-the-10-percent/)) Binary Search implementation on PHP?
 
isn't binary search just a fancy word for dichotomy?
 
@ircmaxell character
 
woo
11:23 AM
@FlorianMargaine yep, it is
@FlorianMargaine Nevertheless, there are number of non-correct implementations. Even Java SDK binarySearch had a bug for years.
 
hi guys, i´m looking for some advice...to protect forms from attacks, which is better? htmlentities or strip_tags .... and should i use anything else?
 
@Japa What attacks are you afraid of?
 
don't use strip_tags()
 
@SecondRikudo actually i want to protect the proper way...i´m not looking for "that" kind or another...i just want to do the better way...
@tereško why?
 
@Japa You don't protect a form
You protect whichever medium you are putting the data on.
Before you insert it to the database, you sanitize it for SQL input (or otherwise use prepared statements)
 
11:33 AM
@Japa because it neither good for sanitation nor escaping
 
Before it is outputted for JSON, you use json_encode, before it is outputted to HTML, you use htmlspecialchars
 
so instead of this: $firstname= strip_tags(trim($_POST["firstname"])); what should i use?
 
@Japa Are you listening to what I said?
Or am I writing for no one?
 
i´m sorry..i am reading, but maybe i´m not understanding it right..
could you point me to a good example? maybe seeing it in pratic i could understand it better..
@SecondRikudo don´t take me wrong...i´m trying to understand.
 
11:38 AM
@Japa you don't sanitize/strip when you get the data
You don't know what the data will be used yet
It may be used in HTML, in which case, escaping for HTML makes sense
 
that part i understand...i do it, when i´m inserting into the database
 
It may also be used in JSON, in which case JSON escaping is more appropraite
Alright meeting ttyl
 
@Japa that is stupid. what if you want to present it as JSON, HTML and XML? What if you add another format at a later time?
 
You missed out the most important one...
YAML
 
oh! man
:(
 
11:43 AM
@Japa nothing to be sad about. Just do it when you output the data instead of when you put it in. You still do your form validation and make sure that you are safe from sql injection though (if you are using sql for storage, otherwise replace sql with whatever you use...)
 
♫ YAML... we're YAML... and we hope you like YAML too... Ooh yeah... ♫
 
@Patrick ok...thanks for you help.
@SecondRikudo thanks for your help.
 
prestashop -1 for rep :P
 
11:59 AM
@Jimbo fuck yaml
 
Getting closer... ;-) There we go
 

« first day (1563 days earlier)      last day (3368 days later) »