« first day (1820 days earlier)      last day (3125 days later) » 

2:06 PM
hello
to all
how to get unique user meta values in wordpress
i have a meta key called mycategories
i want that user meta values unique
 
Abe
2:28 PM
datetime implements a myriad of questionable things, but doesn't implement toString
Object of class DateTimeImmutable could not be converted to string ¯\_( '_' )_/¯
 
@Abe Which is correct, because a date time does not represent a string so having a __toString function would be ambiguous as to what it means. The format function method allows you to specify how the datetime should be transformed into a string, by the format param.
 
there's also the stupidest of stupid hacks 3v4l.org/Qoc4p
3
 
Ծ_Ծ
 
which you'd think would be good enough for a __toString, considering it exists at all
 
2:33 PM
◔_◔
 
Happy caturday and mornings
 
Abe
@Danack toString is generally used (read: all languages except php) to expose a string representation of whatever is the object. can be used for debug or anything
doesn't mean that toString should replace the format method
 
@Abe That's bullshit
toString in other programming languages is generally not a debugging mechanism
 
Abe
notice the "can"
 
@staabm disappointing that the default formatter doesn't include the standard deviation
 
2:38 PM
@Abe Can in the sense of misuse, yes
 
Abe
well, yes
@PaulCrovella lazy evaluation or something?
 
side effects in __debugInfo()… o_O
 
@AnmolRaghuvanshi Hahahahaa, your post!
@salathe Damn, genius!
 
which one
 
2:47 PM
@AnmolRaghuvanshi That WORK, BAR, WINE, RUM, BEER
 
Abe
anyway, i hate working with dates. i hate working with dates on others' code. especially those that save non-utc dates in databases. or worse those that in the same database save dates with multiple timezones. how sloppy can one be to do that?
 
@Abe Use unix timestamps? Can be converted to any format and timezone I believe
 
Abe
@HassanAlthaf it's not my code
this guy made a table with what i believe are utc dates, and other tables with cet dates
 
2:49 PM
@Abe Oh, I see. Did the person use just a hardcoded string or something to store dates
Oh, convert the UTC to CET?
 
Abe
it's a huge mess
 
@Abe I saw one recently where dates were store as strings... in multiple languages
 
Abe
he converts dates everywhere
 
How about, you tell your employer,
Your previous developer was a wannabe.
 
Abe
i'm so tempted to trash everything
 
2:51 PM
Don't wanna be harsh, so edited the line.
@Abe I feel you mate.
 
Abe
@Danack yeah i know __debugInfo :P
 
I can imagine, recently, someone wanted me to help with their project and it was a complete mess. :/
 
Abe
my point is that every object should have a string representation
it shouldn't be universal, just representative
 
Just like Java?
 
@Abe Yeah, no. Not every object has a string representation.
 
2:53 PM
@HassanAlthaf If by string representation you mean [Object 0x28470217412084]
 
Abe
why not? it's useful in so many ways
@NikiC yeah not that :D
 
@NikiC Not that.
How did you even type that number lol
 
public function __toString() { return '┌∩┐(◣_◢)┌∩┐'; }
 
for the same reason that not every object has a floating point representation.
 
Are those numbers random, or real?
@PaulCrovella HELL YEAH MATE!
 
2:56 PM
@HassanAlthaf Neither
 
Abe
@Danack the difference is that you can represent a float with a string, but not a string with a float. so you have string but not float
 
And you can't represent a datetime object without a format.
Or at least shouldn't.
 
pick a useful standard format and go with it
 
iso ISO 8601 or gtfo :P
 
@PaulCrovella Fine. We'll add a __toString() returning dates in mm/dd/yyyy
 
3:04 PM
@PeeHaa just use unix timestamps and be happy
 
Abe
@NikiC lol
 
@NikiC ahaha
 
@bwoebi unix timestamps don't make me happy at all
 
@PeeHaa me neither… they're just nice for storing and offset minpulation
 
3:06 PM
@PaulCrovella :)
 
@NikiC I'll take it, because 'murica!
 
Modern day "programming" with composer: I have to write an extra layer so I can safely use (and possibly later swap) a third party abstraction layer for git that uses a 3rd party abstraction layer for the command line
Also my /vendor directory (with dev enabled though) is 50MB+
 
#9thworldproblems
 
Are there any known collisions for MD5 in the <= 16 byte input space?
 
That question scares me
 
3:18 PM
I know, right?
 
@DanLugg what is your real question?
 
That's my real question; given all inputs of 16 bytes or less, fed through MD5, are there known collisions?
"settle a bet"
 
I doubt there is a rainbow table fo dat
 
Thanks!
Hmm, birthday paradox says yes. But it says yes to everything.
 
Just note a 16 byte rainbow table with all "normal" characters is already pretty fucking huge so proving you won the bet is going to be hard ;)
@DanLugg lol
 
3:26 PM
Well, better start investing in storage and sharded SQL...
 
:P
 
@DanLugg This is clearly a webscale problem. You need MongoDB
 
Not enough async.
 
I have an uncharacteristically wimpy Doberman :-/
 
3:28 PM
@DanLugg Okay, how about you store the data in MongoDB and do computation in node.js?
 
@NikiC So, this is a startup from 2011 now?
 
hold on, i think there's a jquery plugin for it
 
jquery.md5.collisiondetecter.lte16byte-1.0.7.js
 
@DanLugg well… it's impossible to not have a collision there as the output length is just 16 bytes too… and as you say <= 16 bytes, you have to include the ones from 0-15 bytes too, which makes the set of possible inputs bigger than the number of possible outputs…
 
LGL
Should child comment be in different table?
 
3:32 PM
if you consider remote code execution vulnerabilities as "distributed computing" I'm sure we could drum up a large number of wordpress plugins to help out too
 
@PaulCrovella With performance of wordpress sites you are better of running it all on your own machine
 
@PaulCrovella o_O
> I think it is interesting that the property can be accessed using reflection. Using the following (Reflection) example I can access the property:
$dt = new DateTime();
$o = new ReflectionObject($dt);
$p = $o->getProperty('date');
$date = $p->getValue($dt)); // returns the value of DateTime::$date
Who started this trend of asking "how can I use reflection to "solve" my problem?" instead of "how can I solve this problem without reflection?"
 
3:50 PM
@marcio Well… it's like choosing between restricted tools and an universal knife. You just have to learn the knife once… instead of every single restricted tool. So, isn't it obvious that we use Reflection?
 
@bwoebi like, in this case, to access a property that shouldn't even exist and implement your code based on some underlying bug?
 
:-D
 
no, thanks :D
 
could be worse.. could be runkit
 
let's just put runkit in core j/k
 
3:57 PM
I vaguely remember an impassioned request for that on github
crap, not finding it now.. was an entertain read too
 
that's just ruby leaking
 
Which is the natural state for Ruby.
 
:/ I've been into ruby, I've seen horrible monkey patched accidents.
 
standard practice for writing unmaintainable ruby is monkey patching, much like how in php we slop together html with business logic, and how in perl we write perl
 
4:22 PM
Monkey patching is a good thing when you break it down: monkeys are cool, and I make money spending my whole day patching stuff.
 
sdd
4:44 PM
Which of you PHP programmers is interested in joining a project that involves making a script automating tasks?
 
Hey, I'm looking for that GH issue where the php framework had a version with an accidential rm -rf in it and it deleted users' files.
@PeeHaa @NikiC One of you probably knows which one I mean
 
Ummmmmmm
 
I can almost taste it
@BenjaminGruenbaum \o/
 
4:51 PM
nothing much
How's you today?
If I clone from a bare repo without any commits. Is checking whether git log -n 1 returns "fatal: bad default revision 'HEAD'" a sane way to check whether the repo has actual commits?
 
LGL
@Orangepill how do I make the voting system, if user already vote, just update the new vote if they do it again?
 
@PeeHaa moving houses, lots of work.
 
@PeeHaa I prefer to use git internals for these checks: ls .git/refs/heads/
^ this lists the existing branches including master, if there are no branches the repo is certainly empty.
 
@BenjaminGruenbaum Ah yes. That tend to bring in some work yeah :)
 
New house has garden though, love that part. Great location too.
 
5:04 PM
@marcio Ah yes. Much nicer than have to rely on some random error message
@BenjaminGruenbaum Cool. Where are you moving to?
 
5:18 PM
@BenjaminGruenbaum robomow.com
 
@Gordon It even has an app! /me is going to buy two and outfit them with missiles
 
Anonymous
Aerial view of the the lawn oO? Now, how does the app do that?
 
@PeeHaa inside Tel Aviv
@Gordon recommend?
I don't have grass in my garden though
@Gordon that website is hilarious, they translated it from English to Hebrew without context. English ads always sound super excited and pumped about what they're saying - it sounds completely ridiculous to an Israeli shopper so translation needs to be aware.
 
LGL
5:33 PM
Ugh this confuse me, I just want users to be able to vote once only
INSERT INTO
  votes (user, post, value)
  values (:user, :post, :value)
    ON DUPLICATE KEY
  UPDATE value = VALUES(value)
 
Anonymous
which one is the unique key?
 
LGL
value
 
Anonymous
ah
 
LGL
This is value setting
 
Anonymous
isn't value reserved keyword?
 
LGL
5:39 PM
It use to work, Until I add the CONSTRAINT
I mean I can change it, but i doubt thats the problem
 
Anonymous
it seems it is a reserved word
 
LGL
Okay I will change it let see
 
I would use backticks for columns and table names any ways:
SELECT `user`, `value` FROM `users`
 
Anonymous
not necessary if you know the name is not reserved
 
@HamZa do you really have a column named "value"?
 
5:49 PM
@tereško he does lol
or she or it
 
Anonymous
:\
 
.. I get this feeling that you have been talking to one of tiny people again
 
probably
 
whatever the case might be, using column "value" is fucking stupid
hell, naming that column "i dont know" would make it a much more descriptive title
 
for composer packages do I need to upload vendor folder on server or it's not needed?
 
LGL
5:52 PM
@samayo I change it to vote, nothing change :/. everything will be named properly once it goes to production.
 
Anonymous
@LGL to what did you change it to?
 
LGL
vote
 
@LGL name it properly from the start is a looooot better than later on...
 
Anonymous
ALTER TABLE votes ADD UNIQUE KEY vote (vote);
 
LGL
K I change bunch of them yesterday too.
 
Anonymous
5:54 PM
Just ran it, to make sure it is a unique key.
 
Anonymous
then insert the same value to vote to see if you are getting duplicate key .. error.
 
LGL
K one second, I need to change the values in App as well.
 
@AjmeraInfo you should be running composer update --no-dev on the production server
so, no, you shouldn't be copying vendor folder
then again, you probably should be doing git pull (unless you have a proper deployment system) anyway, instead of copying
 
Anonymous
hmm, didn't know this existed. Remove unused styles from CSS
 
@tereško you meant composer install --no-dev right?
 
6:06 PM
no, I actually did mean update
because if package is not installed, it will still install it
 
LGL
@samayo same result, here is my scheme if that helps pastebin.com/Kfb69Yc6
 
running composer update on a dev machine generates a lock file which says the exact versions that the unit tests were run against. You then put the lock file in version control and do compose install --no-dev on the production machine. That installs the exact same versions as the unit tests were run against. Doing composer update on the production machine may result in production upgrading to a new version of libraries than the tests were run against.
 
Anonymous
@LGL Not sure what the problem is really. Wild guess, would be there is something wrong with the foreign key reference.
 
LGL
No is not the foreign key, I remove it and same behavior.
 
Anonymous
@Danack is the mysql guru here
 
Anonymous
6:19 PM
-
 
LGL
K I will wait
If I remove the AI it works :/ @samayo
 
Anonymous
that doesn't make sense at all.
 
Anonymous
let me know the real issue if you managed to solve it
 
LGL
I know, really weird.
 
@Danack heh, actually you have a point there
 
6:35 PM
What do you use IDE ?
or, what IDE do you use?
or, what IDE are you using?
 
LGL
MySQL Workbench
 
@LGL good, but what software for coding?
 
LGL
Sublime Text 3
 
ok, good
 
"Which IDE do you you use?" or "Which IDE are you using?" (the latter is more appropriate when you are asking about the IDE that the person is using right this moment)
 
6:38 PM
ah! tnx for that point
 
LGL
How is this possible? with AI don't work without AI work fine. Wth
 
Anonymous
@LGL can you ask it in the main site?
 
LGL
Yes, i was waiting for @Orangepill cause his the one that show me how the first time. after I will post if we couldn't solve it.
 
Is there something that needs to be configured on Centos 6 to allow the loopback address to work? The problem I have is that I have a server that has an IP address bound to it. Doing a request to that IP address from the server appears to be going out to the internet, before returning to the server. Which means that a service that is configured to only allow access from 127.0.0.1 is failing.
So presumably I want the network card to know to loop that request back to itself?
 
@Danack do a: ip link
 
6:51 PM
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9001 qdisc pfifo_fast state UP qlen 1000
    link/ether 06:55:15:67:73:2f brd ff:ff:ff:ff:ff:ff
which appears to be IPv6 only.
 
could you localhost instead of 127.0.0.1
 
Sorry - I meant that it's going through the servers domain name so as to hit the correct nginx server.
and the resolved ip address for the domain name is an IPv4 one.
....i think I'll just create an internal.phpimagick.com and stick that in hosts, rather than fiddle with network config.
 
7:16 PM
@samayo have you found a job?
 
Anonymous
@HamZa not at all. I have a rendez-vous with these guys so they can debug me :p
 
@samayo GLHF
 
LGL
How many people here went to college for computer?
 
@LGL I'm currently doing that but it doesn't matter much since self taught people are way ahead than the normal ones as I see it even at the campus
 
@Danack in /etc/hosts just add 127.0.0.1 localhost
Also, your webserver probably isn't listening to localhost possibly
 
7:22 PM
@samayo btw, any luck using SO careers?
 
LGL
@HamZa yeah i started when I was 12, I'm starting to learn high-level ones now, But idk should I just go get the degree for it?
 
Anonymous
@HamZa Nope. I got like 3-4 interested employers, but they were all in the German speaking part of Switzerland, so knowing German was required.
 
@LGL I see. A degree is always a plus IMHO. How old are you now?
 
LGL
24
 
@LGL not too late (never actually) but make sure you're financially and mentally prepared :P
 
LGL
7:27 PM
Im considering it after my App. Im building a social App currently.
I just get little confuse with database
 
@samayo More than what I've got! I got 2 messages but one is from a company that links students (interns) with companies. The other one got it from a hosting provider
@LGL unless you think you can beat FB/G+ then I don't see why you're building such a thing
 
LGL
Its an iOS social app, I believe I have a good chance. Proxy Social App.
 
@LGL good luck then
 
LGL
Thanks, PHP and Swift are the sheeznet
lol
 
Anonymous
Actually, these day I am focused on finding bar tending jobs, mostly from 5 - midnight. that is a much better alternative. @HamZa
 
7:32 PM
@samayo as long as you get a stable income and try to improve your php skillz (or build some reputation on github?)
 
Anonymous
Actually, a career as a developer seems less and less likely for many reasons. But, if I get a night job, I will go to school and get a proper diploma for the sake of having a more secure feature.
 
Anonymous
If I am going to be in the same situation at 40, with wife and kids .. I'm screwed.
 
@samayo I see what you mean. Whatever feels right, do it :)
 
Anonymous
7:49 PM
@HamZa I'm working on something right now, I'll ping you once it is finished.
 
@samayo cool :)
 
8:12 PM
@Andrea there were mainly a lot of problems bindTo() had and call() inherited the same ones… don't think it's your fault ;-)
 
Morning v2.3
 
@PeeHaa \o
 
@PeeHaa well, did version 2.3 BC break the morning to the actual evening?
 
@bwoebi Fuck no. 2.3 di break the evening to the actual evening
@HamZa \o
 
@PeeHaa oh okay, fine.
 
8:16 PM
@bwoebi You sounds disappoint
 
@Andrea just wondering… is it intentional that you're using reply to and not reply to all?
 
cock
 
@PeeHaa definitely.
 
:-(
 
8:40 PM
hey! finally i m on chat
 
That's what I said 3 years ago. Pro tip: you better run :P
 
@SwapnilDewakar heya
 
hmm
actually i got account a month back
but i m really try this from yesterday itself
and i have got 31 reputation in a day
Is it good or bad
 
@SwapnilDewakar does it matter?
 
I couldn't care less about fake inatnetz moneyz
 
8:46 PM
yes i thought
 
9:01 PM
@PeeHaa I heard SO is going to start allowing you to sell your karma for bitcoin soon.
graymarkettrades.com
 
hi guys
for last 2 years I mainly done JS, now I got stuck with some basic mysql query :(
can somebody give me a hand?
 
No, I value my hand way too much to give it to you.
Besides, how else will I drink my coffee?
If you ask a question, however, I might have an answer for you...
 
@Sherif your English syntax is really hard!! ".. I value my hand way too much..". what is mean of it?
 
SELECT
events.host_scores,
events.visitor_scores,
events.start_time,
clubs.name
FROM events
INNER JOIN clubs
ON events.host_id = clubs.id;
I feel dumb :D
 
@DušanRadojević what's the problem?
 
9:07 PM
I need names for both host and visitor team
that code logicaly provides only host name
 
@DušanRadojević you'll need to join the table for each selection you want:
SELECT
events.host_scores,
events.visitor_scores,
events.start_time,
host.name as host_name
visitor.name as visitor_name
FROM events
left join clubs as host
ON events.host_id = host.id;
left join clubs as visitor
ON events.host_id = visitor.id;
and alias the table to be able to resolve which is which.
 
thanks so much
it is of a huge help
did not worked with database for so long
 
@Danack oh! I get that now! really how you understood the structure of that tables?
anyway, well done!
 
 
1 hour later…
Anonymous
10:14 PM
what is the smallest psr7 library
 
smallest in code size? minified? ;-P
 
@samayo do you mean implementation? I think there might be an example implementation attached to the docs for it.
 
Anonymous
We are just debating we someone as I really didn't want to use zend-diactoros it looks bad to me. I just need an alternative, hopefully smaller in size.
 
Anonymous
@kelunik
 
Anonymous
That thing has traits, clone, static methods, overriding constructors ... egh
 
10:21 PM
That's probably one of the least worst usages of traits.
 
Guzzle is also PSR7 compatible.
 
The problems are with the spec, not that particular implementation.
 
Anonymous
guzzle is too big
 
@samayo why are you concerned with size? guzzle one looks ok to me.
 
Anonymous
10:24 PM
It is a just a very small application. Performance is everything.
 
Anonymous
yeah, that classic my app is too small for .. problem :/
 
if your app is too small and "performance is everything" why are you trying to adhere to a PSR that aims to be general purpose across frameworks?
 
Anonymous
Not my idea. This is a group project, me being the starter :/. They want PSR7 because they are advanced programmers, and we're trying to find a middle ground between that and my stubbornness due to lack of experience.
 
Anonymous
so, I am pushing for "performance first", where as they are on the quality side.
 
so there is 99% of chance that you're the one pushing on the wrong side ;)
 
10:30 PM
hlw everyone
 
Anonymous
@marcio make that 99.8%. :p
 
Anonymous
@kelunik Guzzle is for clients only right? not servers.
 
Anonymous
> PSR-7 HTTP message library [currently mising ServerRequestInterface and UploadedFileInterface]
 
unless it's very obvious that some architecture decision will perform poorly when executed, don't be the one conjecturing about performance too soon.
 
Do you need a HTTP client or server?
 
Anonymous
10:36 PM
server of course.
 
You can use different libraries for both.
 
Guzzle is a Micro Framework mainly used for communating with other serve and it is not client based it is server based.
 
LGL
@samayo I create a SQLFiddle if it help sqlfiddle.com/#!9/7dd8d/1
 
@jewelhuq er, no. In no sense is it a framework.
 
LGL
the votes should be 0, cause there +1 and -1
 
10:42 PM
@jewelhuq Micro framework? It's just a HTTP library.
 
Anonymous
http framework .. maybe
 
user5405273
does anyone know how i could create facebook login system?
 
@AniketSingh you could follow any of the tutorials that come up for "php facebook login system" ?
 
user5405273
i have followed but after redirecting from facebook nothing is stored in database and blank page is shown
 
Anonymous
10:44 PM
@LGL so what was the query that was getting submitted instead of updated?
 
LGL
Sorry i don't quiet understand. @samayo
 
@AniketSingh blank page on your server means that your code has an error, and you have configured PHP to not show errors:
346
Q: How do I get PHP Errors to display?

AbsI have checked my PHP ini file and display errors is set and also error reporting is E_ALL. I have restarted my apache web server. I have even put these lines at the top of my script and it doesn't even catch simple parse errors. For example, I declare variables with a "$" and I don't close state...

 
Anonymous
@LGL I mean, what was the insert statement that was giving you duplicate error ?
 
mornin
 
user5405273
thanx @Danack
 
LGL
10:51 PM
One second I will write question for better understating. @samayo
 
a duplicate error means you already have a value in a primary key or unique column that matches the value you want to insert.
 
Anonymous
@Porlune the problem is not with the vocabulary.
 
Anonymous
OP keeps getting dup error instead of row getting updated on duplicate post
 
is he using an insert or an update clause?
 

« first day (1820 days earlier)      last day (3125 days later) »