« first day (2568 days earlier)      last day (2380 days later) » 

Wes
5:04 PM
@Orangepill at least php is going the the right way now. i mean, function autoloading still doesn't get voted, but at least we don't get stuff like (unset) merged in :B
with the possible exception of <=>. and void. sorry andrea :B
 
hello everybody, anyone of you that can help me using this api? api.coinmarketcap.com/v1/ticker i want to specificly look things up from this api. example (i have the variable $coin = BTC, i then want to take the price_btc from that variable(BTC) and put it in a variable called $price
i dont exactly know how to use api's like this yet or even if this is possible
 
5:19 PM
It's json, you json_decode it and have it as an array, then you search them in the array @FluffyMe
 
@Ekin yeah that part i know, but i dont know how to specificly look something up
 
@FluffyMe You've got a long road ahead of you. Start with what @Ekin said. You say you know that but clearly you don't.
What does json_decode() do?
 
it litteraly decodes a json array, string
 
Not quite right but close enough. Converts json string to an array.
So you have an array now. And you want to find something in that array. Google around with that info
!!? Get value out of array php
 
Search for "Get value out of array php -site:w3schools.com" (https://www.google.com/search?q=Get+value+out+of+array+php+-site%3Aw3schools.com&lr=lang_en)
• how to get single value from php array - Stack Ov… - 8 dec. 2010 - Now, $myarray['email'] etc. will output as expected. … It returns the values from a s… (https://stackoverflow.com/questions/4383914/how-to-get-single-value-from-php-array)
• Return all the values of an array - PHP.net - The above example will output: Array ( [0] => XL [1] … This is another way to get value from a mult… (http://php.net/manual/en/function.array-values.php)
 
5:25 PM
$api = file_get_contents('https://api.coinmarketcap.com/v1/ticker/');
$decoded = json_decode($api); $decoded->symbol this will get me all the symbols. I am already using it but like specific and @Jeeves thanks ill have a look at it
 
@FluffyMe You're welcome!
 
@Jeeves thing is this is just a value i know how to get a value but not like in SQL. SELECT uid FROM users. i want to select price_btc WHERE symbol is my $coin. i did already google before i got here but cant find that
 
@FluffyMe Help me if you can I'm feeling down.
 
@Jeeves sup
 
@FluffyMe Nothing much. I'm in bed. What about you?
 
5:29 PM
@Jeeves trying to work this api out
 
@FluffyMe Cool.
 
@Jeeves alright then
 
@Jeeves and I do appreciate you being 'round
 
@FluffyMe So, what do you wanna talk about.
 
@Jeeves Waiting for @Jimbo's mum?
 
5:29 PM
@Ekin Help me get my feet back on the grounf.
@ToukaXKaneki And now my life has changed in oh so many ways..
 
fucking bot isnt it
 
Turing test
 
:D
 
@Fabor im kinda new to json and api's so could you help me with my problem?
 
5:34 PM
@FluffyMe When you're new there's a plethora of resources to help you. When you're old you have fewer and fewer. Learn to debug. here.
 
Wes
ahahaha
 
@Jimbo ^^
 
@Fabor dont want to be an asshole and thanks for the help but this is not what im looking for. I want it to be that when i have a variable $coin = btc it will lookup where symbol is btc and then grab the price_btc
 
@FluffyMe Show me some code in a pastie site
 
looks nice but top-align would be better imo
 
Top-align?
Which element tho?
 
Oh, yeah that is kinda hard on the eyes, should reduce the margin... Nice find! Thx!
 
Stranger Things 2 anyone?
 
Wes
6:01 PM
did it start?
felt like ages since season 1
 
Yup
There's a recap
 
@Fabor what kind of code and why :)
 
Released a few hours ago
@FluffyMe Whatever youre currently writing so I can see
 
I really wanna have a beard :<
 
@Fabor i can send you the whole code but it wouldnt make a diffrence ;0 i told you what i am trying to do. why should you need my code then
 
6:06 PM
@ToukaXKaneki So grow one. :)
@FluffyMe Because your explanation of what you're trying to do is poor, so looking at your code to ascertain what it is you really want helps.
Only the relevant code would matter, not everything.
 
Wes
does someone know why reflection constants' bitmask looks like this
const integer IS_STATIC = 1 ;
const integer IS_PUBLIC = 256 ; // 2 ?
const integer IS_PROTECTED = 512 ; // 4 ?
const integer IS_PRIVATE = 1024 ; // 8 ?
 
I don't even have a moustache yet, really doubt I can grow a beard... When did you guys start having facial hairs of sorts?
 
Anonymous
Is there a spl implementation of the mkdir function in php?
 
@ToukaXKaneki Genetics. For me around age 16-18. But not a full beard till maybe early 20s.
Eastern Asians have poor beard genetics. Generally hairless for instance.
Girls over here don't even need to shave their legs.
 
Wes
@ToukaXKaneki you are indian... i've never seen an indian without mustache / beard
must be something to show off there, right?
like abs in the western world :B
chances are you are likely predisposed to grow beard and mustache
 
6:12 PM
Nah the region I'm from beard or mustached doesn't really matter. Tho it does in the western reagions
 
you are on earth. beard and mustache matters.
 
Tho our physics teacher has a glorious beard, and everyone at our school admires it
 
@Fabor dont have any code yet because i first need to get this otherwise i cant get anywere. i'll try to explain it a bit better. In my code i will eventually have a variable named $coin in this variable there will be a symbol of a coin (BTC) so the variable will be $coin='btc'. Now i want to go into the api.
Lookup where the symbol is BTC (gyazo.com/dfd9318405eaf5d7063290450a115e51) and then grab the price_btc from that coin (gyazo.com/b9a02ad821c2301c8a10d9c64afbb5a2) and put it in a PHP variable named $price
 
Wes
welp
 
@FluffyMe Grab that json, convert to array. Rebuild the array with the coin as the key. Then you can do $newArray[$coin]['price_btc'];
If I am understanding.
 
Wes
6:17 PM
@Ocramius welp
 
no
 
Wes
thanks anyway. i am trying to understand but it might be there is no explanation
maybe they match php's internal values
 
I'm trying to understand some JS stuff here - makes 0 sense
 
@FluffyMe This?
 
@Ocramius js always makes sense, especially the scope
 
6:20 PM
It's almost as if they wanted to do it in PHP in JS in PHP in JS in PHP
 
@Fabor yeah :) thanks a lot
 
Wes
@Ocramius can we help?
 
@fluffyme $price = array_combine(array_column($src = json_decode(file_get_contents('https://api.coinmarketcap.com/v1/ticker'), true), 'symbol'), $src)[$coin]['price_btc'];
 
@Wes morphine
 
6:23 PM
1d20/2 chances of being scope issue, 1d20/4 of being polyfill issue, 1d20/4 chance of being callbacks hell problem
^
I'm glad to see though, that you are not taking the :x shortcut @Orangepill
you gain like, a hundred points of relevantness
 
Wes
@Ekin thank you very much :D (2)
 
yw :)
I was looking at it after I saw that tweet
 
@FélixGagnon-Grenier on a related note... TIL :x
 
Wes
that explains why reflection is such a mess @Ekin
god
 
6:39 PM
@bwoebi why shouldn't it? tbh if you asked me I'd expect it to do that
(array) binds quite tightly
 
evenin
 
posted on October 27, 2017

New Cyanide and Happiness Comic

 
@Fabor why does this give an error tho: sandbox.onlinephpfunctions.com/code/…
 
@Fabor how come the link doesnt work? it should
 
Because A) you're missing "file_get_contents()" and B) When you do add it the site will error saying it isn't allowed for security reasons.
That's why I pasted a string in there.
Never assume things are correct. Go back step by step checking your variables are what you think they are.
 
@Fabor i see works perfect on localhost thanks\
 
@Andrea hmm. I'd expect ?? to have like the highest precedences
 
@bwoebi in any case I copied the precedence some other language used, I think it was C#'s
 
6:52 PM
@Andrea Well, it makes sense for the operator on the right, but not on the left
You usually use null-coalease on a variable value (dereferences, fcalls, simple vars), not a compund expression
I.e. I wished $a + $b ?? $c + $d bound as $a + ($b ?? ($c + $d))
Which is, TBH kind of weird from a language perspective, but quite what I'd expect…
 
If I had my way, ANY grouping of binary expressions would require explicit parenthesis
 
@Sara s/binary//
 
votes Sara for dictator
2
 
@Sara at least apart from math ops, there it would be quite annoying
 
Nope. ALL ops.
 
6:58 PM
@JayIsTooCommon you can laugh at me once more \o/ soundcloud.com/user-93315143/sleepy
 
@Sara would be a bit too spammy of parens I guess.
 
Parens are usually spammy, not just for math...
Lets instead forbid the use of redundant parenthesis :P
end of 7.0 active support in one month
 
@NikiC Id' like to see + and - evaluated before . (concat).
 
@bwoebi agree
Current precedence there doesn't make a lot of sense
 
7:39 PM
I am importing data from csv into database and it is working, but it inertting all rows from csv file
the top row is bascly name of the table not data, so my question is how can I avoid that
if($_FILES['file']['name'])
{
$filename = explode(".", $_FILES['file']['name']);
if($filename[1] == 'csv')
{
$handle = fopen($_FILES['file']['tmp_name'], "r");
while($data = fgetcsv($handle))
{
I am doing like this
 
7:51 PM
Save yourself some headache: github.com/thephpleague/csv
 
@bwoebi (I (don't know)) what (you mean)
 
Wes
@DaveRandom thoughts on star trek discovery?
it might get a decent show after all
 
@Fabor thanks but it is really small project. Is it possible to add a line of code to skip the first row of csv?
 
Yes.
13
Q: Skip the first line of a CSV file

Nathan DunnI am trying to import a CSV file. Due to the program we use, the first row is basically all headers that I would like to skip since I've already put my own headers in via HTML. How can I get the code to skip the first row of the CSV? (the strpos command is to cut off the first field in all the...

 
thanks
 
Wes
8:19 PM
@bwoebi is it ok if a rfc proposes to add a language feature that would require some additions to reflection, but doesn't specify exactly how these reflection additions should look like?
 
8:34 PM
Is there really a lot you can do for large table LIKE queries that begin with %?
 
use fulltext instead?
I can't seem to find an in-depth article of what happens internally when people do SELECT * FROM table. I guess the engine has to select stuff from information_schema to know what to actually select, but I have no proof of it.
 
Wes
8:50 PM
fulltext for the win (unless you are german cc @PeeHaa)
 
/me waves
 
Wes
\o
 
Still pretty slow :(
 
Wes
are you sorting the results?
 
Nope
 
Wes
8:55 PM
so something is wrong. mysql?
 
Just a SELECT COUNT(*) WHERE user_id = 1 AND CONTAINS(foo, 'bar')
 
Wes
mysql?
i have no idea what contains is. it could be something new
 
Table isn't that big either, 12 million. Probably the lack of normalised data. :(
Some biiiiig columns in there.
 
Wes
in mysql it's MATCH() AGAINST()
i do searches on 50+ million rows and they run in less than 0.1s
 
FTS?
 
Wes
8:58 PM
yes
 
Does it have a few columns with varchar(2000) in there? :P
 
Wes
i have text(65k) :B
it could be that count(*) is making it slow. i never use count
try SELECT * FROM
 
Well simple COUNT(*) took 13 seconds.
 
Wes
i still don't know if you are using mysql
 
just select id then use rowCount on the stmt
literally 10 times faster (in the specific case I think about, which obv is the same for everyone)
but yeah, fulltext is normally pretty fast
 
9:01 PM
Running in CLI ATM.
 
Wes
unbuffered queries also help for counting in case of mysql and php i think... i don't remember anymore
with unbuffered queries data is never transferred to php unless actually accessed with fetch or fetchall
but you can count it
 
You people I have been telling to read the Kingkiller books to better do it soon. They may be adapting it for TV.
 
kingkiller... that some rip off Jaime Lannister's early years?
 
Wes
/me opens netflix
damn i don't remember anything about stranger things
 
then Wes disappears for 10 hours
 
9:15 PM
heh
Read them you fools!
 
Wes
eh i hope i don't
 
@Fabor hmmm, it does seems relevant to my interests
 
It's Skyrim in books
 
Wes
nope i need to rewatch it
i have no idea what's going on
 
9:18 PM
lol
 
Pretty much. Even a famous quote from Skyrim comes from that book
 
wat second season is out already?
 
yes
For Stranger Things
Oh Sam, what will Frodo think if he sees you now. (Stranger Things S2)
 
Wes
well at least i remember the first ep
i think i can skip it
 
9:29 PM
what the topic?
 
Wes
stranger things?
php sometimes :P
 
meh
 
Wes
ah i remember who dies already
okay i might start to remember what's going on :B
@tereško it's not bad, but it's too early to judge
 
^++
 
Wes
it's certainly better than a bunch of other series that i tried to watch and that were shit almost from the beginning :B
 
9:36 PM
I rarely watch any series
hell, I have lately been reading only books and playing games
 
youtu.be/84q-uIjlWWE also this is nice
 
Wes
also the kids are incredibly talented and i like that
they sell their part so well
 
indeed
 
@tereško Generally Stranger Things has been well received.
Watch Mr. Robot too
 
Eh, the first series was alright
But it got worse during the second series
 
9:43 PM
Agree
 
Have you watched Limitless?
 
Series and movie yes
 
Cool, I really liked that series
the movie not so much
was quite dark :p
 
Series is a bit happy-go-lucky
Dark is good
Mindhunter on netflix is great too
 
/me googles Mindhunter
 
9:45 PM
If you don't like dark then you won't like it.
Netflix original released last week or so.
 
lol, k
Is it a documentary series?
 
No.
 
ah, ok
How good are you at php?
 
Set in 1960s follows the start of the Bahavioural Science Unit at the FBI. Loosely based on true story
On a scale of 1-10 I am about C+
 
loll
C+
is not on the scale
 
9:48 PM
There's plenty of extremely capable PHP developers here. Even a lot of PHP 7 contributors.
 
Nah, just curious
I don't need help
 
A few release managers too
 
wow, IDK that
 
Luckily Taylor Otwell doesn't come here though.
 
who's that?
 
9:49 PM
Larevil creator.
 
ahh, right
I really love Laravel
3
it is just the best
This question is not very useful, but a good programming problem: stackoverflow.com/q/46690032/3088508
 
Thalidomide was once widely prescribed too.
 
What?
 
We're not kind to Laravel here.
 
Ohh, lol
why?
Is there another laravel chat room?
 
9:52 PM
Not on SO. But there's an IIRC.
But before you depart.
Laravel is a poorly built crutch. You'll hopefully learn that one day.
 
lol, but an elegant crutch
 
wow lol
"I really should stop being surprised by the stupidity that comes out of Laravel's community"
'"Laravel Excel" ... I did vomit a bit in my own mouth'
wow
seriously not kind lol
 
We go a little OTT with it sure but the reasons behind those are true.
The takeaway is Laravel has a place in web development as much as McDonalds does in the food industry.
Look how popular McDonalds is, but is it good for you?
 
lol no
but it's delicious
 
9:57 PM
Correct, and Laravel is good for churning out websites.
 
What're the reasons behind the mutual feeling of hatred toward Laravel?
 
Here
We don't generally approve of frameworks, it's not strictly Laravel.
It's full of bad practice, false MVC and doesn't teach people how to use PHP.
 
Hmm, ok
 
People become Laravel certified not PHP certified.
 
lol
indeed
 
@David Rule of thumb. If you need it done fast and cheap, go ahead and use Laravel. If you are doing a personal project with the goal of furthering your development ability, go no framework.
2
 
10:20 PM
Anyone here have had any experience with PHP multi-threading. Just would like someone's general thoughts on their experience
 
My thought is that you probably don't need it
 
Dang, PHPUGRMN was today? I thought it was yesterday...
 
What's PHPUGRMN?
 
:)
 
There's exactly one google result for it
 
10:30 PM
@David exactly? that's rare
 
Yes
exactly
@Ocramius What's PHPUGRMN?
 
10:44 PM
o/
 
I don't get that result. It actually thinks i'm referencing German language courses
 
lol
 
Now that Sophia the robot has been given Saudi citizenship, does turning her off equate to murder?
 
@David user group in Mannheim.
 
@Ocramius wow, that's an obscure acronym for anyone who's never heard of Mannheim
sounds vaguely German :P
@crypticツ I think that Sophia shouldn't have been given citizenship, it's a FRIGGIN' ROBOT. But IDK about that
Sounds like a good SE question :P
 
11:00 PM
@crypticツ I don't think so. Because turning her on would be "bringing her back to life" which means she was never dead in the first place
 
@IROEGBU Sorry, I don't follow. If she was "brought back to life" that would imply that there was a severe absence of life i.e. dead.
 
dead is dead... I don't think there's any constitution that considers miracles
 
Hmm, well hypothetically if a person killed another person, and then brought them back to life, would the murderer be sentenced to jail?
IDK
Well, 'twas fun talkin' to y'all, I G2G rn, cya!
 
That's what them tricksters do, in a way.
 
what tricksters?
 
11:06 PM
The ones that put people in boxes and stab the boxes and make people believe they killed their subjects
 
Wes
11:24 PM
bye bye Barb
 
11:53 PM
Schrödinger's Sophia?
 

« first day (2568 days earlier)      last day (2380 days later) »