« first day (1767 days earlier)      last day (3406 days later) » 

16:00
thank you
Why so many people hate PHP, I love PHP
@NSGod update your statement to "Why so many people hate, I love".
Make since
@NSGod if you change jobs or your boss hates PHP, that's ok. You learn things in PHP that are just as viable in other languages.
16:02
I use many other languages like Swift, Javascript and seems like everything play well PHP to me
Do arrays get slower to iterate depending on the type of values stored? Also should I iterate over 2500 objects or split up to have smaller subsets?
@Ocramius indeed. added it to the answer. thanks.
I want to know how to master PHP now? my level is OOP in PHP now
@chozilla I would imagine "pointers" are being used. So the values wouldn't affect the slowness. But the number of values would. IMO
16:04
/me leaves to cook dinner, lata
Anonymous
@chozilla I don't think arrays get slower, but you could run out of memory .. and I think it's much efficient to iterate 2500 objects than to split them up .. again this is a memory issue
@RonniSkansing Thats Interesting
I still find the amount of upvotes on that answer insane for such a trivial thing
user924016
@NSGod try it out
I believe the arrays will get slower based on the number of key collisions the hashmap has.
16:05
Yeah I'm reading now, I never use frameworks anyway, that OOP is the power
@NSGod Do you know swift?
Yes Sir @HassanAlthaf
If you have any question lets go to NSChat @HassanAlthaf
whenever someone asks me whether I know Swift I tell them to shake it off, shake it off.
@NSGod Yes please, lets talk there.
@Gordon LOL.
Lol
16:06
@chozilla Here is an interesting read on the subject nikic.github.io/2011/12/28/Supercolliding-a-PHP-array.html
Anonymous
@Orangepill How does an array get slower? It's just a language construct isn't it? All it does, will not change how big the array is ... anything related to speed/performace decrease in the middle of a script seems like issue with ram/process to me
Anonymous
^ wild guess
@Gordon i just overflew the question, isn't get_object_vars() a valid solution as well?
@samayo internally the arrays are hash maps with colliding keys being implemented as linked lists.. for each key collision you have to traverse the list to get to your value. Read the linked blogpost
@samaYo some of the SPL data structures are better suited for large amount of values than others. There is some benchmarks at github.com/jleider/SPL-vs-Traditional-PHP-Benchmarks
16:09
@Gordon kewl
@chozilla depends. get_object_vars(new Foo) will only give you the public ones. you'd have to call it from inside the instance to get all the properties
If you know the number of elements ahead of time and you don't need string keys then SPLFixedArray is faster and more memory efficient.
@Gordon hm and also you might want to follow up on objects being stored in the properties. So maybe json_decode(json_encode($object)) works better?
oh no that should be only public too...
hm... actually i should know this but I dont..
@chozilla nah, OP asked for quick and dirty and I feel the answer is good enough for most usecases
user924016
it's not that dirty
user924016
16:15
doing the encode/decode looks real dirty =]
user924016
but not as quick
@Gordon could you somehow use a closure and set the $this context to the object to get the privates and protected values? I think I tried that once.
... since we are already talking dirty ;)
user924016
@Sjon nice update on 3v4l
@chozilla not sure. try it.
@Gordon json_encode() skips private and protected properties regardless of the context it is called it seems.
Ok it changed in php 5.4
user924016
16:26
@chozilla 3v4l.org/cPIjm
user924016
wheps nevermind =]
looks very broken to me. what happend with the name of the property? >_<
user924016
16:42
3v4l.org/5huD5 I was reading about branch prediction and tried it out in php... anyone know why pre php7 the unsorted array is faster to iterate?
ok this confuses me a bit. 3v4l.org/6ONUs
It looks like bindTo does not work like the Real thing...
@chozilla you have to bind a class scope as well $fooExpose = $expose->bindTo($foo, get_class($foo));
hi
how to calculate time from longitude and latitude using php mysql
i have longitute and latitude
in database
i want to get time
if the distance is 5 km
1 hour like that
@madu use math
@Orangepill can you show me any simple querys for that
16:54
@madu stackoverflow.com/questions/574691/… ... and then all you need is a speed to convert to a time.
@Orangepill cool that works: 3v4l.org/ELP0b
also json_encode never lets me get privates.
it's weird that the classes object context isn't the class of the bound object by default
@chozilla think it will if you implement the JsonSerializable Interface
@Sjon All boxes shrink and grow while running code now. :-(
@Orangepill how can i distance parameter which is not there in database but i am keep distance as please see my query so how can parameter
$target_distance = 5; //50km is approx 31 miles
$retrievedrivers=mysql_query("SELECT driverprofilesstatus,driverprofilesid,driverprofileemail,driverprofilephonenumber,driverprofilesfullname,( 6371 * ACOS( COS( RADIANS( '$base_lat' ) ) * COS( RADIANS( driverprofileslatitude ) ) * COS( RADIANS( driverprofileslongitude ) - RADIANS( '$base_lng' ) ) + SIN( RADIANS( '$base_lat' ) ) * SIN( RADIANS(driverprofileslatitude ) ) ) ) AS distance
FROM driverprofiles
WHERE driverprofilesstatus='free' AND driverprofileslatitude IS NOT NULL
@chozilla With PHP 7, you can use $expose->call($foo): 3v4l.org/PjJZb
17:02
is any possobile
@Orangepill yes you can add private values by hand with the interface implemented.
@kelunik I know but who uses php 7 ^^;;
@Orangepill did you understand my question Mr.Orangepill
@chozilla PHP 7 is the only PHP.
@kelunik: it doesnt have the cool features that where promised for 6.0 I am disappointed with php 7 ;)
@chozilla :P
17:05
@madu I have no clue what you are asking... tell me what you have and what you want to get.
obviously you have a table that contains of locations expressed in latitude and longitude. You want to find a distance to what?
@Orangepill i want to get the time like if the two longitute and latitute suppose i have 5 km so i want to getwhat the time required to get from this longitute to latitude i am creating taxi app so the app developer asked me calculate time required from longitutde to latitude which was in my database
where are you getting the second location from ?
and this query is working in kilometers
yes
ok i will my app develper clearly
and i will ask you
can you wait for a while
Mr.orangepill
might be here but if you run into issues google "halversine distance calculation" for hints on what you need.
17:17
i have a doubt with app developer what he is asking first i will clarify that with him i will try first and if not getting i will ask you Mr.Oragepill
although the spherical law of cosines is referenced as a more performant means to getting spherical distance
If I do just a print$sql, what is supposed to actually show?
Just the db table and column names or the actual info from the db table and columns?
Hey guys, could you recommend anything to prepare for middle/junior PHP (backend probably) developer interview? I'm uh sorta entering market again, after working for 3 years on my first job, not sure where to really start.
Right now I'm going through code of my two most advanced projects - symfony enterprise-y apps, to be able to tell about the types of projects I've done so far. Next step is going to be repeating generic algorithms and data structures, although I'm not sure they're going to ask me about that.
17:37
@Ivan0x32 Depends on the company and position you're applying for. But data structures and algorithms is an excellent place to start brushing up.
I don't know .. I've been at the same place for 16 years
If it's a startup, for example, they likely are more concerned with you hitting the ground running than more elite tech giants, who would be focused on your grasp of computer science fundamentals and problem solving skills.
Yeah its a big corporation, sort of, they have something like 1000 employees in entire country. So I guess I should focus on CS fundamental then?
Definitely not a bad place to start. Big O, Sorting algorithms, Hastables, Trees, Graphing problems, P vs NP problems, binary math, task scheduling, context switching.... There's no shortage of things you likely don't remember from school by now :)
If you know specifically what platform they are using I would brush up on that as well just so you can convey that you will provide value quickly.
17:45
I find that practicing on a whiteboard will definitely help you if they do whiteboard coding in the interview.
I see, thank you so much!
Anonymous
@Ivan0x32 good luck! :)
Thank you! I'll look into that :)
17:49
@Sherif I hear the guy that wrote that is a hack
:)
@Orangepill Aren't we all?
I know I am :)
that project euler looks like fun
@Orangepill One day 23 years ago I decided I wanted to learn BASIC and there was no one around to teach me. So I bought a used QBASIC manual from a garage sale with my allowance and started teaching myself through trial by error. 23 years later.... here I am!
So clearly anything can be learned. The question is whether or not you have a desire to do anything with it.
hi all
@Orangepill You should probably also have a look at Top Coder then ;)
18:04
@Sherif same story here +7 years and with C64 basic
Hey you guys
have you ever used Memcached library?
user924016
@Danack lol
@Danack Reminds me of i.imgur.com/FW5TASg.gif
18:09
Can you please tell me its technical solution?
how do I say I that what I say I speak for myself in English? I want to say "on personal account", but google tells me that's not it
@Danack ^
Basically I want to say something is ok for me personally, but I am not speaking for the others
user924016
speaking on behalf of myself?
Yeah, but I thought there was some other way to say it
user924016
hit this on google but havent read it english.stackexchange.com/questions/10684/…
what's the full context?
18:15
print$sql doesn't actually show the table data, correct?
@PeeHaa Something like "These views are my own, and do not necessarily represent those of my employer or any other organisation"?
@Orangepill Client requests something. I want to say: fine by me personally, but I do not speak for the others here so I need to check
@Danack Something like that, but less "heavy"
God this english thing is hard :P
@PeeHaa In that case it would be more "I have no objection, but the decision does not rest with me, I (or they) will need to ask the people who do".
I forget that a lot of the people here aren't native english speakers because they write in english better then most americans
@Danack Yes I think I can use that
ty
18:19
@PeeHaa "It can be understood through tough thorough thought, though"
@Orangepill It helps being a programmer and basically already having to write engrish the entire day
@Danack wow
That is just awesome
You really don't see how fucked up english is until you have to help a grade school kid learn to spell
@Orangepill hehe
@Orangepill wat! u tryin 2 say I dun speek no englsh or wat bro?!
@Orangepill Now help a kid learn to spell Dutch!
Yup, that's English for you.
@Orangepill What's the plural of Octopus?
:D
Octopi
@Orangepill lol
@Orangepill Yup, but also Octoput and Octopuses is also correct.
Ok, how can I check to make sure I am pulling the correct data from the right table in my db again
18:24
Octoput ?
I did not know that.
that is not a word
@Orangepill octopodes - it's from greek for 8 feet
@PeeHaa Yes, because it derives from a Greek word and so Greek suffixes are accepted by grammarians.
TIL
Now just wait til somebody says it like that and I can act like I am smart
18:25
English traditionally used Latin suffixes so things like Octopus became Octopi, but then again many English words also have "es" as plural suffixes so Octopuses is also accepted by grammarians.
Those two I can understand
This is the fun that is called English!
@Orangepill I am going through one of my files and redoing it by copying and checking line by line. How can I check that I am pulling the correct data from the right table in my db again?
@benlevywebdesign it depends on context and what you intend to do in a given context.
Well yesterday I found out that when you click on a destination in any trip it then goes to tell me that it's from a different trip even though its not. It edits it correctly but it jumps you into that other trip.
^^^ LOOK AN OCTOPUT
user895378
OCTOPUT /resource HTTP/1.1
Host: localhost
Content-Length: 8

feeeeeet
@Orangepill benlevywebdesign.com/ontheway/destinations_list.php?id=15 If you click on the top right "info" icon you will see the that the trip info id is 15 and the trip name is "Madis Goes Shopin" If you click on "Rimi" and click the pencil edit icon. It tells you that the "Rimi" came from "Stackoverflow PHP Chat Test Trip" which has a trip info id # of 114
It clearly did not come from "Stackoverflow PHP Chat Test Trip"
@rdlowrey lol
18:37
@Orangepill In all fairness (being a Git icon) it's really more of an octopull
badumtish
@benlevywebdesign look at where you are get that information... looks like you aren't getting the trip with id 15 ... probably getting all the trips and reading through them all in a while loop and ending on the last one
@Orangepill yup thats what I am trying to fix
I am working on it right now
octoputty-tat
Linkedin just keeps buying up companies left and right.
Not sure if this is a good thing yet :/
18:44
@Sherif I wish they'd merge with Twitter. Then they could be called Litter
That twitter!
I'm not sure if this speaks to Jack Dorsey's proven track record in not ever having built a successful company or the fact that we always knew twitter was just a horrible idea gone viral.
@Sherif if it's social media, doesn't it going viral mean it's by definition not a bad idea?
@KevinMGranger Not necessarily. Lots of things social have gone viral and died out over the years.
It's just that now there's a lot more stupid money in Silicon Valley to keep them alive stubbornly for a bit longer.
That's actually dangerous.
18:50
MySpace ftw
or Slashdot
@Orangepill Yea, that's the problem. The only viability for half of these "social" giants was acquisition. The only ones that made it out unscathed were Twitter and Facebook.
Every social oriented company I hear about today gets acquired by some bigger company. Microsoft got Skype and GroupMe. Yahoo got Tumblr. Facebook got Instagram and Whatsapp. News Corp got Myspace. AOL got The Huffington Post. The list goes on!
can't believe AOL is still a thing
Yea, they still have a pretty good engineering presence in NY actually. They've stepped up their game over the years.
NY Times too.
@Orangepill It's not. They shuttered Joystiq and I doubt they have the cash for too much else. I mean 56k is dismal in this day and age
19:01
@Machavity Well, they were recently acquired by Verizon.
That they were bought by Verizon for $4.4B still blows my mind but it's prolly to wind it all down and consolidate
They own a lot of IP actually.
Most tech companies these days play a secret IP game ;)
prolly from their brief time as AOL-Time-Warner
Look at what it's done for Oracle :D
Yep, patent whoring is a real thing
you know, Oracle has solved all of MySQL's problems. You're not allowed to look for security holes anymore
19:05
@Machavity I know it's in the EULA!
and God help us all if Oracle is allowed to charge Google a fee for their "copyrighted API"
I trust them. If they say it's secure, who am I to audit their code?
The fact that Google's stock is still climbing despite that fiasco amazes me.
Those guys bounce back from anything.
Every time you audit there code the terrorists win.
@Sherif what fiasco?
@bwoebi The lawsuit? wsj.com/articles/…
19:11
The caption Oracle v. Alphabet is somehow more accurate.
@Sherif that's not a fiasco…
@bwoebi Well it's a loss for Google which hurts shareholders confidence, obviously.
@Sherif It's a loss on paper.
Paper costs money you know
exactly that's what they loose… a tiny bit money nobody worries about.
19:16
Oracle is suddenly looking a lot like the Winklevoss twins.
"I know ... I'll make all my fortune by suing everyone that has money and is successful!"
@Sherif don't use analogies not understood globally^^
@bwoebi The Winklevoss twins aren't understood globally?
There was a movie and everything!
i don't think public api's should be copyrightable
@Orangepill Honestly, I don't even think software patents should exist.
19:19
agreed...
hey folks, what could possibly be wrong with this?
@Sherif so, what do you want to patent then? Only the hardware?
$sub_msg = substr($vm->getMessage(), 0, 35);
                                            echo $sub_msg;

                                            if(strlen($sub_msg)>35) {
                                                echo '...';
                                            }
@bwoebi Sure, because that's a commodity, but the whole notion of software patents is just idiotic.
It goes to show that people don't understand the usefulness of software.
@anaslmt your sub_msg will never match the if condition because you are truncating to 35 characters
19:22
right
i should use the original one, /facepalm
@AnasLmt Here's a better way to do what you're trying to do: $sub_msg = sprintf("%'...'-35s", $vm->getMessage());
Avoid if if at all possible ;)
Well, maybe that's not exactly what you want, but a good start.
Guys it it possible to select COUNT of records in database in a query that includes many other things? Like so
SELECT u.id AS uid, u.username AS username, pr.profile_pic AS pic, pr.profile_bio AS bio, COUNT(u.id) AS total_users
@Sherif This isn't about software patents...
@NikiC What isn't?
The Oracle law suit?
Yes
19:25
I know that. I'm just expressing my disdain for companies that are known software patent whores.
Oracle is one of them.
Ah, of course
@matthcw that query doesn't make sense... you are counting something different then you are selecting.
And yes, software patents are ridiculous
Just like most patents, really
There is some utility to a patent. I agree that not everything should be open even though I believe we should default to open.
am i supposed to echo $sub_msg afterward @Sherif
19:26
Some things are actually not in our best interest to be open.
I can see asserting ownership on an implementation ... but not on a concept or a public api.
Especially when it is the case that that thing is something the competition has a vested interest in gaming.
@AnasLmt You want to add an ellipsis only if the string is greater than 35 characters?
There certainly is utility in patents, but only insofar they are used for appropriation of research investments
Which, outside of a few special cases like pharma, they are generally not
@Sherif yes exactly
user895378
if (isset($string[35])) {
    $ellided = substr($string, 0, 35) . "...";
}
19:29
The bulk of the current problem is exacerbated by people not making products and making shell companies in East Texas to get favorable outcomes
@rdlowrey One of the few cases where I'd approve of using MB functions...
user895378
@NikiC or you could just check for a space
@rdlowrey You are a strange creature :P
@rdlowrey That usually looks like if (strlen($string) > 35) $string = substr($string, 0, 32) . "...";
@rdlowrey With some additional logic to prevent 5000-char words, yeah
19:31
@rdlowrey the most annoying thing about appending ... is when you could fit the remaining 2 chars in there where the ... now is...
@bwoebi You know there is a UTF-8 ellipses ;)
user895378
PHP really is just about concatenating strings lol
Forget bytes if you only care about characters.
@rdlowrey (and it's horribly slow at that ^^)
allocating a new string upon each concat…
Yay for mutable strings!
19:33
gah
@Sherif strings are mutable… when you use bitwise ops on them :-D
Unless they have by-value semantics, mutable strings are horrible
@bwoebi Sure, they just didn't have to be.
(Which is why they are not horrible in PHP)
Hi All, Sorry to interpt in between, I am trying to pass a POST variable from outside to a codeIgnitor application. stackoverflow.com/questions/32081101/… Any suggestions what should I do.
19:35
@NikiC Question for you. What do you think of the idea that arithmetic expressions could be represented internally as binary trees in PHP?
@NikiC wondering if one could optimize $string .= $foo; in a way to only realloc $string (instead of making a copy of $string)?
.... as in how Java does it
@Sherif not sure what your point is?
@bwoebi I'm curious if representing them internally as a specialized tree could make things like parsing and operator precedence simpler
@bwoebi Don't we already do this?
19:37
I was toying with the idea of nested ternary and how you could avoid the force-precedence semantics entirely just by putting them in trees.
@Sherif that implicitly happens at compile time with the AST?! … or what is your point?
thanks @sherif @rdlowrey and @Orangepill, its good now
@Sherif Aren't they already?
@NikiC I don't know. That's why I'm asking you.
@Sherif They AST for binary operators is a binary tree
19:38
Ahh, makes sense :)
@NikiC oh, we do.
I just thought it was interesting how Java does it since you don't actually have to store the braces as in the infix notation in a post order traversal.
So forced precedence just becomes simpler
Guess I'll have to look into your AST extension a bit more closely.
I weep for humanity now. I searched for a MySQL function and got W3 Schools
@Machavity I used to have an iptables rule that droped packets with w3schools.com in them, but then I realized I was also not getting messages on IRC anytime someone said "w3schools" ... heh
I thought there was a way to block them on Google. Not sure if they still do it though.
@NikiC confused $a .= "a"; and $a = $a."a"; … of which the latter is eternally slow.
19:52
@Sherif why did your code show '-35s?
echo sprintf("%'...'-35s", $vm->getMessage());
@AnasLmt Oh, the - is for right vs. left padding
But you probably don't want that anyway. I may have overlooked your requirements.
yeah ... if the message was "Hello" you would get hello followed by 30 dots.
@anaslmt there is also a css way to do that if you are just trying to prevent your content from exceeding it's container.
oh i see @Sherif
@Orangepill i have that covered i guess.. i'm just trying to make the code as small as possible
@AnasLmt That is a strange requirement
Keeping the data in the markup and visually suppressing it has SEO advantages.
20:03
is that what i'm doing @Orangepill or the opposite?
@PeeHaa why?
@anaslmt no you are doing the opposite... you are truncating the data going to the client
@AnasLmt Small code should "never" be the actual goal
@PeeHaa Well, that's not always true. Think of mobile and embedded devices for example
20:05
number of character is a poor gauge of the rendered length of the text... let css deal with the visual truncation.
I wouldn't say "never", but certainly not your first goal.
@Sherif See those quotes?
Aye
@AnasLmt your avator is like who has +100k rep :-) ! I don't know why I have this feel about your avator ....
:-)
20:07
Quotes usually imply emphasis.
bold or italic does ;)
@Orangepill i'll just keep that in mind for future projects. this one is kind of private so i don't need SEO advantages, right?
Mostly because of the lack of blink or marquee in chat
@analmt it's your call...each technique is a solution to a distinct problem ... which one is the right solution is up to you.
@peehaa this would be a much more exciting place with marquee enabled.
I am agree :)
20:14
@Sherif precedence comes before the tree representation. That's taken care of during the conversion of infix notation to the tree notation
@ircmaxell Oh no, I know that. What I meant was that it becomes simpler to consume :)
consume?
Yes, as in, I find it easier to manipulate the expression vs. say dealing with the infix notation in a stack.
I guess it's just a matter of preference, but I find that you can do more interesting things with it that way.
I'm implementing std::vector in a way that you can choose the underlying storage type through template parameters (e.g. you can choose to use uint32_t instead of size_t).
It's been pretty fun so far.
@Sherif if you're manipulating code, you really need to use either a tree (AST) or a graph (CFG). Doing it at the token level is ...problematic...
20:25
I second that.
@ircmaxell how is your suite of static analysis tools coming along?
@ircmaxell Right, which is why I was asking the question of whether using expression trees makes more sense. I just wasn't aware it was already represented in the AST as a binary tree.
@Orangepill haven't had time to really devote to it
@Sherif it's not technically a binary tree
because nodes can have more than 2 children
the subset of the tree that is a binary expression is a binary tree
@ircmaxell I get that. It's a specialized tree.
right
example, ternary operator is a ternary tree (expression, if, else)
20:28
The way Java does it I think it's always 2 nodes though.
Because they don't have ternary operators.
yes they do
Oh?
I guess I'm reading outdated text then.
I may have said that too fast
This book is pretty old.
And my understanding of Java internals is about as useful as my understanding of astro physics :D
ok, Buffer just lost themselves a potential customer
20:40
Who?
Interesting. Never heard of it before.
@ircmaxell a friend of mine works for them, so I feel obligated to ask why?
20:59
@Orangepill well I re did that file and I don't think the issue comes from that file. Now to check the other file...making progress
@Danack well, nevermind. It turns out it was a twitter issue
But I already sharpened my pitchfork...
which means 1 DOS and 2 MITM vulnerabilities reported to twitter
21:11
Firefox pay for those kind of reports.
@Fabor Twitter has bug bounties as well
Oh? Cool. Bug bounties sounds like a cool website name. Cowboy themed.
@Fabor so do twitter - hackerone.com/twitter
Wonder if anyone makes a career off of these.
@Fabor This was originally reported by "Bender from the future" with a year of 3012 github.com/rails/rails/issues/5239 - that guy earns a significant chunk of change doing it.
21:20
heh nice
if you do too much sniffing for an exploit what are the chances that you would get prosecuted as an attacker?
I suspect most online services that have a bug bounty are under so much attack anyway, that they don't have any time to bother trying to track people looking for exploits down.
Mr. Robot. That is all.
@Danack Actually there is a way to deal with that. It's called anomaly detection. You only bother to find the data that sticks out from all of the other data and you don't have to waste your time trying to prevent every single threat. Just the ones that are definitely abnormal.
I saw quite a bit of that when I was at Tumblr.
Most attacks are generally harmless. They're just looking for a way in. It's figuring out how to anticipate that someone is close that's really time consuming.

« first day (1767 days earlier)      last day (3406 days later) »