« first day (1751 days earlier)      last day (3188 days later) » 

12:15 AM
@Andrea and things like memcpy() are implemented sometimes as a macro too… but it isn't uppercase.
 
@bwoebi ewwwww
in fairness, it is just a special case of assignment
 
@Andrea that had bitten me once on OS X…
 
and that's an expression, so
string(6) "testin" (packed)
omg, it works!!! @NikiC @bwoebi
 
nice… looking forward to all these cases which will break in obscure ways…
 
yeah
I already know something that might break
string(6) "testin" (packed: 0x6e69747365740d)
$ php -r 'var_dump(hex2bin("6e69747365740d"));'
"tring(7) "nitset
Oh, not quite the endianness I was expecting
Little-endian is weird ^^
Fun things!
The empty string is now just (zend_string*)0x1!
 
12:25 AM
@Andrea including a \r … pfah ^^
 
@bwoebi hehe
Also, turned out I didn't need to modify all the refcounting code!
It already handles interned strings
So I changed ZSTR_IS_INTERNED() to check for packed strings :3
 
12:49 AM
hi guys any wordpress genius ?
 
that's an oxymoron
 
lol
 
@Andrea now it's time for benchmarks with callgrind ;-)
 
maybe tomorrow :p
I'm impressed how little code was necessary for that
The actual implementation of zend_string_packed is tiny.
 
@Andrea yeah… a 40 lines.
 
morning
 
@NullPoiиteя Hi!
 
1:27 AM
\o
> Laravel is so awesome, I can't even say Laravel is implemented in PHP. It's more like PHP is implemented in Laravel.
7
 
...
Oh yeah, string packing works on UTF-8, too!
$ sapi/cli/php -d error_reporting=0 -r 'var_dump("naïve");'
string(6) "naïve" (packed: 0x6576afc3616e0d)
Any string up to 6 bytes :D
$ sapi/cli/php -d error_reporting=0 -r 'var_dump(PHP_EOL);'
string(1) "
" (packed: 0xa03)
C++: The Good Parts http://t.co/3R1pHJtztw
 
 
3 hours later…
5:12 AM
quiet in here
 
yaa too quiet
 
5:43 AM
Morning.
:)
 
morning
 
@NullPoiиteя LOL SO TRUE
Laravel really feels good when writing code, but when we go and refresh, it's like we are in hell. :/
 
i didn't say laravel is that good i just quoted from reddit :(
morning
 
I know it is not good.
Lol
I felt the sarcasm.
 
@Orangepill o/
 
5:46 AM
Btw, is there any NullPointerException in PHP?
 
\o @NullPoiиteя
 
sure it wasn't
 
Objects with 50-60 methods a piece. That's because it's more efficient to put more methods in one class, and Taylor Otwell is smarter than normal people and can maintain a codebase with objects that big without becoming confused. This is why only Taylor Otwell can maintain Laravel.
But what about maintainability and Single Responsibility Principle.
 
Taylor Otwell is smarter than normal people : Not true
Taylor Otwell works smarter than normal people : May be true
 
5:49 AM
@NullPoiиteя He probably is smarter than me. :P
I can't imagine the implementation of laravel.
 
working harder != working smarter
 
ahh i missed that , thanks corrected
 
Neither do I have the time to waste to learn the implementation of sht stuff.
@Orangepill Efficiency king! :D
 
you think, learning is wast of time :D muhhahahahaha
 
ikr
But ye, it's worth it if you wanna save yo time, and code very fast
I really like its Eloquent ORM
 
5:51 AM
honestly I haven't looked to hard at it but when I saw all of that static calls in the example code I just backed away
 
All you do is create a class and then all it statically.
@Orangepill ye, I hate static calls,
You can fetch all columns like this:
$user = User::find(100)->first();
Simple as that
Any other ORMs like that?
MySQLi be like
 
Doctrine is
 
Oh
link?
 
@Orangepill laravel is not that bad, i tried it and it works fine and lot easier to work
 
Mysqli is not an orm... it's a lower level database api
 
5:53 AM
I know.
I just saying
compare MySQLi code to Eloquent ORM
$statement = $this->db->prepare("SELECT all row names FROM users WHERE id=?");
$statement->bind_param('i', $id);
$statement->execute();
$statement->bind_result($user);
$statement->fetch();
$statement->close();
 
come on you can develop your own class which can do the same
 
Compare that shit to
 
what does sht means ?
 
$user = User::find(100)->first();
but yh
I'm gonna look for an ORM.
 
I prefer a more domain object specific "orm"
 
5:58 AM
What do you mean by Domain Object Specific?
 
Have a class that is in charge of fetching and storing a specific type of object
 
Like, a factory class?
 
behaves like a factory but with a persistence store
 
$user = $userRepository->getByUsername("frank");
 
6:01 AM
Oh.
Laravel works the same too.
$user = User::whereUsername("frank")->first();
 
$userRepository->save($user);
 
yup
User::save($user);
Dont ya kno? xD
i love its ORM
 
or do you mean User::save($user)
 
just not the framework
oh yh
its dope af l0l
Eloquent is what made me try Laravel, or I would've refused my client to use Laravel.
 
can you use the ORM sans the rest of the framework
 
6:04 AM
what do you mean
 
can you run Eloquent without running Laravel
 
I'm not sure.
Ye we can.
Just found a link.
 
Okay .... so you can but you have to have a container class to emulate the framwork
 
6:13 AM
Container class?
 
is there a way to add a column to a query IF it exists?
 
ye
there is a query method I believe
where you can run the manual queries like we do in MySQLi and PDO
0
Q: Eloquent query alternative

CozzbieHow can I write the following in Laravel's Eloquent? SELECT * FROM ( SELECT real_estate.property_id, real_estate.amount_offered, payee.summa FROM real_estate LEFT JOIN (SELECT property_id, SUM(amount) AS summa FROM payments GROUP BY pro...

Look, a complex query written in Eloquent.
 
I have a feed a feed of user content and the idea is that i want a column in my result that determines if the user making the request has liked each row being returned or not.

SELECT b.type, b.owner, b.update_img, b.ALBUM_ID, b.last_comment, a.uid, a.first_name, a.last_name, a.gender, a.thumb_img, b.msg_id, b.message, b.created, b.POST_PRIVACY,c.LIKED
FROM users AS a, updates AS b, BUMPS AS c
WHERE b.uid_fk = a.uid
AND b.POST_PRIVACY <> '4'
AND b.POST_PRIVACY <> '5'
AND c.LIKED_UID = '1'
AND b.msg_id = c.MSG_ID_FK
 
I dont know that much SQL
lol
But there is a way I believe.
Eloquent is the best ORM out there imho
 
looping through a array of rows returned from mysql to add additional key/values is so damn expensive response time wise.
I can solve this so simply by just looping through the feed results and doing a simple isLiked query to add the key/value into each row , but it takes our response time from .5 to 7 seconds
 
6:33 AM
Wow..
Google is gonna give the whole of our country free WiFi.
They're gonna place 16 Air Balloons to provide WiFi to the whole Island. :)
 
6:46 AM
@ChuckKelly I'm assuming AND b.POST_PRIVACY <> '4' AND b.POST_PRIVACY <> '5' indicate a like condition
nevermind
what value is in LIKED
 
7:03 AM
@Orangepill its a bool
here is the closest ive come so far , maybe it will make my goal a little more clear:
SELECT b.type, b.owner, b.update_img, b.ALBUM_ID, b.last_comment, a.uid, a.first_name, a.last_name, a.gender, a.thumb_img, b.msg_id, b.message, b.created, b.POST_PRIVACY,
case(when a.uid in (select UID_FK from BUMPS WHERE b.msg_id=c.MSG_ID_FK) then 1 else 0 end)
as isBumped
FROM users AS a, updates AS b, BUMPS AS c
WHERE b.uid_fk = a.uid
AND b.POST_PRIVACY <> '4'
AND b.POST_PRIVACY <> '5'
ORDER BY b.created DESC
LIMIT 100
 
you need a join condition for your bumbs
so you want data from all users with updates that include if if they like the update.
not like but bump
SELECT b.type, b.owner, b.update_img, b.ALBUM_ID, b.last_comment, a.uid, a.first_name, a.last_name, a.gender, a.thumb_img, b.msg_id, b.message, b.created, b.POST_PRIVACY,
count(c.msg_id_fk) > 0 as isBumped
FROM users AS a, updates AS b left join BUMPS AS c on (b.msg_id = c.MSG_ID_FK)
WHERE b.uid_fk = a.uid AND b.POST_PRIVACY <> '4' AND b.POST_PRIVACY <> '5' group by a.uid, b.msg_id
ORDER BY b.created DESC
LIMIT 100
maybe
 
@Orangepill bumping is liking on our system , i tried to convert it over and explain it as "likes" to make it easier to explain , but yes i want to return a users feed and include a column called "isLiked" that acts as a bool to determine if the user making the api request has liked any of the rows being returned.
 
okay ... so maybe a a.uid = c.uid ?
 
your result is close , but ur result would only tell me if a update has been bumped by anyone , not the user making the actual request.

Example: Tom posts a update , Stacy likes tom's update ( which creates a record in the likes table ) now @Orangepill
comes along and views the feed.... using ur query it would claim that you liked toms update .
and @Orangepill the free wifi is starting in New York from what I heard.
 
7:19 AM
a.uid = c.uid ?
or whatever you call the foreign key on BUMPS to the user table
throw that in there and it should eliminate those results from the count(c.msg_id_fk)
 
c.UID_FK , but im fucked man idk how the fuck instagram and yak do it, i think ur version will work but its just sucked all my speed gains to all shit. might not be a way around it . im giving in for the night
 
morning
 
 
1 hour later…
8:36 AM
@HassanAlthaf Yep, and that's shocking. Static calls everywhere, active record. Honestly a load of rubbish.
 
@Jimbo have you found a database abstraction you like? because I have been searching for 15+ years, and I haven't found one, in any language, and I'm starting to get fairly convinced that the real problem cannot be solved by abstracting relational...
 
8:53 AM
I had a mysql table with 10,000+ rows of user data. Some users have more than 100+ rows. When I going to select a row, it's too slow now. What I do?

Create a table for each user and insert their own data into their unique table. Is this good? Is it waste my disk space? Is it slower thab before?

Thanks
Mention me for a answer. Thanks
 
@mindplay.dk I genuinely enjoy using Doctrine. Data Mapper > Active Record, plus I regularly chat and complain to a guy who works on it so I've learned a lot about it's intricacies. Thing is though, even he suggests not using it in a lot of circumstances. For me though, I've not hit the point where it's not been useful for rapid prototyping and good code at the same time
 
@VarunaLex The first thing I would look at is indexes - if you're lacking half decent indexes, queries will be slow.
 
I need to a query that does not selects anything ! I just want to check a value is exist in a column or not, I don't need to fetch, then I don't want to select any thing
here is my query:
`$dbh->prepare('SELECT * FROM users WHERE email = ?');`
should I put what instead of `*` ?
 
@VarunaLex 10k rows is nothing for mysql - partitioning the table in the manner you suggest is unlikely to help in my opinion
@Sajad I would suggest just the email column - as I understand it if the email column is indexed, mysql will likely only need to look at the index and never touch the table itself in that case.
 
@AllenJB then what I put instead of * in my query ? I don't want to select any thing, I just want to know about existing ...
 
9:07 AM
How can i connect to oracle database which is in VPN network using oci_connect
 
@Sajad As I said, either just the email column and then just look at the result row count, or alternatively you could do something like COUNT(email) AS c if you always want to return a result with the number of matches in
 
+ limit 1
 
@JaakKütt I don't need to limit, because my column is unique
@AllenJB alright, tnx
 
@VarunaLex @Sajad Suggested reading on MySQL: use-the-index-luke.com and O'Reilly's High Performance MySQL
 
@Jimbo I'm going to be stuck with Doctrine for the foreseeable future, it seems - it was selected while I was away on vacation. If I could have had a say, well... I worked with NHibernate for 1.5 years, and it was a gross and painful exercise...
 
9:18 AM
@mindplay.dk The problem is you want people who know what they're doing using it. It can quickly be used to do some terrible stuff, great power and responsibility etc... same with any tool really
> After building it from scratch I'd start with something like CodeIgniter. This will get you the basics for the MVC pattern.
> Yes. Laravel is the most popular framework at the moment, it encourages good practices,
You know what reddit, why do I even click you?
One half of my brain is like "ha, at least they're not going to progress anywhere that knows what they're actually doing" and the other half of me weeps because these people's souls are beyond saving. #phpdrama
 
@Jimbo I think the real problem is not the abstraction at all, it's the relational is just fundamentally wrong for what we're trying to use it for. Nothing we work with in software is tables - it's all graphs. Tables are just a piss-poor fit ;-)
 
@mindplay.dk So what you'd be looking at more of a NoSQL solution?
 
@Jimbo I would, I have been, for years - nothing is "there" yet, I haven't found anything yet that can fully replace MySQL or Postgres.
@Jimbo the closest thing is OrientDB, I think - but the PHP driver is third-party work, it's outdated and under-maintained. I've been peeping ArangoDB as well, which as good driver support, but lacks schema.
 
when I use of limi 1 (in my query) what happens ? first finds all results then show me 1 of them ? or when found 1 row then breaks ?
 
limi 1 doesn't do anything. limit 1 does ;-)
 
9:31 AM
lol
 
Morning guys
 
@Jimbo limit 1 what does ?
 
Guys I have a question.
If I have to retrieve rows from the database what is the best way for doing it ?
I mean should I use mysqli_store_result() ?
 
why do you care about best way ? because there is no such best way
 
@Sajad rtfm
 
9:32 AM
or just do this:
while($row = mysqli_fetch_assoc($result)){
    // Further Code...
}
 
> If you need only a specified number of rows from a result set, use a LIMIT clause in the query, rather than fetching the whole result set and throwing away the extra data. Emphasis my own
 
@Sajad why not read the manual
 
> If you combine LIMIT row_count with ORDER BY, MySQL ends the sorting as soon as it has found the first row_count rows of the sorted result, rather than sorting the entire result.
There's some useful info on that page ^ I didn't know a few of those :-)
 
@NullPoiиteя I know what is limit, I just what to know about its performance
 
@NullPoiиteя Cause I wanna adopt the best practices for doing it while maintaining an excellent performance
 
9:34 AM
wanna is not really a word :)
 
@NullPoiиteя I know :)
 
@Jimbo tnx
 
@Sajad and what do you propose if limit does not perform well ?
@ZahidSaeed lol
 
@ZahidSaeed go learn how to use PDO, and use it properly :-)
@Sajad performance of LIMIT depends on the query... use EXPLAIN to learn about the performance of individual queries :-)
 
@ZahidSaeed ircmaxell also write really informative stuff blog.ircmaxell.com
 
9:38 AM
if I use mysqli_fetch_assoc() then does it means that it fetches the row one by one ?
 
lol
why not rtfm
 
@mindplay.dk ok
 
or does mysqli_query() stores the whole result set ?
Cause if it is so then doesn't it effects performance ?
 
(the PHP manual really is not a good source for learning how to do anything properly.)
(blog posts, books and web sites are a much better bet.)
 
Exactly
 
9:40 AM
true but good source to know about functions and stuff
 
True, but very useful if you forget the parameters and return types of functions, etc.
 
as a reference, sure, the PHP manual is indispensible - for learning how to program, it's practically useless. therightway is a good place to start.
 
But, modern tools like phpStorm have eliminated the need to look for those stuff.. lol
@mindplay.dk Nah, it doesn't start from basics for newbies.
 
@HassanAlthaf true, but comments on php.net often has nuggets that's aren't in the documentation panel in Storm :-)
 
So can anyone clear my concept ?
 
9:42 AM
@mindplay.dk who curr? :D
 
@ZahidSaeed do more research
 
@NullPoiиteя I tried
 
@ZahidSaeed Your self. We want you to research. If we say you the what it does, you will remember it max for a day, but if you research yourself, then you will remember your entire life. The idea behind our thinking is to make you learn how to research.
 
But there is not even a single code example of using mysqli_store_result()
@HassanAlthaf I totally agree with you
 
9:44 AM
@ZahidSaeed read the PDO article I sent you, it will explain how to configure query functions to use cursors - to avoid buffering query results in-memory, you need to use a cursor, records will then stream to your script one record at a time.
 
Well, forget mysqli.
PDO is a much more better API to use.
 
@ZahidSaeed mysqli_query : Returns FALSE on failure. For successful SELECT, SHOW, DESCRIBE or EXPLAIN queries mysqli_query will return a mysqli_result object. For other successful queries mysqli_query will return TRUE.
 
@ZahidSaeed what @HassanAlthaf said - forget mysqli. PDO is the modern way to go.
 
whats wrong with mysqli ?
 
It is only limited to MySQL.
Any programmer can hardcode stuff.
 
9:45 AM
@HassanAlthaf And what about PDO ?
 
But only good programmers can make stuff flexible.
@ZahidSaeed PDO allows many other database connections like MySQL, PostgreSQL and loads more which I don't remember.
 
@HassanAlthaf Ahh. Thanks
 
And I believe, that you don't even need to rewrite the code for all these platforms, all you do is change connection settings.
I'm not sure about this though, never researched.
But now, gonna look for it.
 
@HassanAlthaf Where are you from ?
 
PDO vs. MySQLi? The winner is noSQL :D
 
9:48 AM
@ZahidSaeed Sri Lanka.
@NullPoiиteя LOL?
 
@HassanAlthaf How long have you been working with PHP ?
 
@NullPoiиteя Are you talking about stuff like OODBMS? or Network DBMS?
@ZahidSaeed 3 years and counting.
 
MongoDB dont you know about it ?
 
I've heard about it, but isn't it an engine for MySQL or something? @NullPoiиteя
Gonna check out MongoDB
I did see the news which showed that MongoDB got its own servers hacked
Wait, is MongoDB a file based DBMS?
 
@HassanAlthaf can I sort rows of 2 tables according to the date in ascending order and then join them ?
 
9:52 AM
God, Mongo, don't waste your time ;-)
 
@ZahidSaeed In what?
 
Mornings
 
@mindplay.dk Always loved SQLite and MySQL.
 
Key/value is even more futile than relational ;-)
What we need is graphs.
 
I always use SQLite when my clients have a very limited technical knowledge.
 
9:52 AM
@HassanAlthaf Joining both ordered tables
 
Sadly nothing I can find is really ready for prime time.
 
@ZahidSaeed I know, you can do it with SQL.
 
Give it another couple of years, something will take off in graph land, I hope so :-)
 
@mindplay.dk you might wanna see OODBMS?
Object Oriented Database Management System.
There are some stuff I found yesterday, but forgot to bookmark.
Damn, this mongo is nice.
 
@HassanAlthaf Should I use UNION clause or JOIN clause ?
 
9:55 AM
@ZahidSaeed I'm not sure buddy, I don't use databases much. And when I do, I have never had the need to do it.
I don't use PHP much anymore, I use Swift and Java these days.
 
I don't use databases much ? so you use php to create static website :D
 
@HassanAlthaf OK no problem :-)
 
@NullPoiиteя Nope? :P
I try coding stuff like,
HTTP Routers,
Templating Systems
 
@HassanAlthaf OO databases are even farther from viable than graph. There are a lot of similarities anyway - have you seen OrientDB? It uses concepts like classes and inheritance for schema definition.
 
@mindplay.dk Not seen OrientDB, but I have seen some ORMs which do something similar to an OODBMS, but use RDBMS.
 
9:58 AM
@HassanAlthaf Mongo is nice on the surface, but doesn't deliver what it promises, at all. Just my opinion.
 
Hehe, maybe.
I don't have my personal favourites, I just like to learn what I can, to fulfil my customers needs.
 

« first day (1751 days earlier)      last day (3188 days later) »