« first day (1776 days earlier)      last day (3169 days later) » 

10:14 PM
@tereško are you sleep ?
 
not yet
 
Anonymous
oh boy
 
@tereško foreach does not work for fetch()
look this:
$pdostatement = $sth->fetch()
foreach($pdostatement as $end){}
your mean is like that ? ^
I want this: while($end = $sth->fetch()){}
 
no, what I meant was:
$sth->execute();
foreach($sth as $row){
   var_dump($row);
}
 
@tereško :*
really tnx !
worked correctly !
but where is fetch() ?
 
10:20 PM
you can still use it, but PDOStatement class implements Transversable
the fetch() is done when foreach calls next() on the object
to understand how this works, you need to understand what Transversable implementation lets you achieve
 
exactly one of my results was missing !
 
(you could say that it is "intermediate level" technique in OOP)
@Sajad you will have to show more of the code
 
10 results :while($end = mysql_fetch_assoc($result)){}
9 results: while($end = $sth->fetch()){}
 
and how many results you get with my code?
 
10 :-)
 
10:27 PM
@kelunik Looks like we have a regression introduced by that change: github.com/php/php-src/commit/… … Can you please open a bug report, I'll assign it to Julien then.
 
then, what is the problem? nevermind
 
@tereško nothing ! all thing is fine !
@tereško why nevermind ?
are you tired of me ?
 
I wrote "nevermind" because I misread your previous sentence
4 mins ago, by Sajad
exactly one of my results was missing !
 
@tereško ah
 
my brain read it as "exactly one of my results is missing !"
 
10:29 PM
@tereško :-)
anyway my problem solved. but using of execute() instead of fetch() or fetchall() is fine ?
I'm sure, If I ask this question on SO it will get several vote up: execute()-foreach() VS while()-fetch()
 
meh
I don't really need votes
 
your approach is really good ! I thins execute()-foreach() is faster than while()-fetch(), is it not ?
 
the next achievement in SO is for collecting 100K points (at which point one get t-shirt and some junk)
@Sajad they should be the same
 
@tereško so when fetch() is useful ?
 
when you need to control the retrieval of data more precisely
the fetch() method has various options
 
10:37 PM
yes ! I got it
 
.. I get this feeling that you should try reading about PDO
 
@AnmolRaghuvanshi old
 
PDO::FETCH_BOTH and PDO::FETCH_ASSOC and PDO::FETCH_LAZY and ...
 
10:38 PM
@Sajad those let you choose the format of retrieved data
 
@tereško yes, so that is the difference between your approach and fetch()
 
you can set the default type with setFertchMode()
@Sajad easier to read, less prone to errors
 
@tereško yeah ...
 
14 mins ago, by Sajad
9 results: while($end = $sth->fetch()){}
whenever you do an assignment in a while cause, you must have a really good understanding of what data you will be handling
 
ok, what is your opinion about this: $data = $stmt->fetchAll();
 
10:43 PM
@Sajad it's useful, if you expect $data to be something small
 
ah ! also I think it is good for counting ! select count(*) form table where ...
 
also "small" is kinda vague size unit
array with 2 items is small and array with 10000 items is not small
 
how about 3 items ? :-)
 
the "border" is somewhere in between
 
ow ...!
ok well, can I ask another question ? (If you are tried or sleepy tell me)
 
10:46 PM
just ask
 
my error reporting was disable so far, but now it is enable in my server
 
well, that's a good thing
 
and there is several notifice (or warning)
for this line:
$var = $_SESSION['userID'];
because session is not full all the time
and I need to use isset(), right ?
 
yes
 
but I have a lot of this: $var = $_SESSION['userID'];
maybe 20
so I need to use isset() ten time
and I don't want, I think my codes will be heavy and dis-optimized
 
10:49 PM
45
A: Does php run faster without warnings?

Pascal MARTINI bookmarked an article in which the author did some benchmarks about that ; unfortunatly, it's in french... but here it is (maybe you'll understand some parts of it) : Ne faites pas d'erreur And here are the numbers, to help people who don't read french : 10k notices, with error_reporting and...

 
so is it good to I disable error report ?
 
read this answer
 
too fast :-) ! ok I will
 
besides, if $_SESSION['userID'] doesn't exist, do you really expect other values to exist?
 
your mean is like $_SESSION['useNAME']; ?
 
10:52 PM
yes
 
no I don't expect, but I don't want to use if(isset(if $_SESSION['userID'])){}
anyway I don't want to use if(){}
my friend tells me don't use if()
it is not optimized
 
I think we already established that your friends tend to be wrong
 
you offers I use if(){} ?
 
WTF?
"if is not optimized"?
 
if (isset($_SESSION['userId'])) {
    $user = $_SESSION['userId'];
    $name = $_SESSION['useNAME'];
} else {
   .. well, there are no variables
}
 
10:55 PM
no
 
@Sajad emm, ircmaxell is one of people who actually participates in making php
 
@tereško exactly this is what I did and my friend told me don't use it ...!
 
@Sajad why did he say not to use it?
and what specifically did he say?
 
@ircmaxell wait, I will search something in this room and show it to you ...
 
@Sajad let me tell you something
 
10:58 PM
^ ... another php maker (fyi)
 
@Sajad a modern CPU can execute more than one billion (1,000,000,000) instructions per second.
 
@Andrea :-) ! one sec! I will show you something
 
@Sajad unless you are doing something literally millions of times per second, unless your web pages are taking upwards of a second to load, then you are probably wasting your time if you try to "optimise" your code
 
how can search in this room ? (just in my text)
there is several "sajad"
 
you need to know your chat user ID
 
11:01 PM
tnx :-)
 
@Andrea though you can divide that by a factor of 20 or such if you want to execute PHP…
 
@bwoebi 50,000,000 instructions per second still isn't bad
 
Jul 29 at 14:41, by Orangepill
@Sajad some people think 1 if is too many
 
@ircmaxell right. but hence we need to begin optimizing instructions already when we do things tens of thousands of times per second…
 
stop that
@Sajad I think you miss the point of that, and in all honesty that is a higher skill level. Master how to use the constructs before you start taking them away
 
11:04 PM
@ircmaxell I just asked using of 7 if statement is bad in one page ? all told me yes ! it is bad
 
@Sajad that is regarding polymorphism in OOP. You are not even close to understanding what it is about.
 
@Sajad I tell you… it depends.
 
@ircmaxell ok, tnx :-)
 
@ircmaxell he doesn't have access to youtube and his internet bandwidth is highly limited
 
11:07 PM
@bwoebi that's only an order of magnitude or two less
 
i watched them :D
 
but 10^9 / 10^2 is still 10^7
 
@tereško I will use the university internet
 
you do that
 
@tereško ok, using of 1 if-else is better or 4 isset() ?
 
11:09 PM
@Sajad suggestion: stop worrying about better
6
get it to work
then worry about cleaning it up
 
@Andrea right… and then your loop has like a 20 ops… and 50k is quickly the size of a dataset…
 
@Sajad focus on making your code easier to understand .. after you have made it actually work
 
@bwoebi Sure.
Hot code needs special optimisation
 
someone telling you something is "better" or "worse" doesn't make a difference unless you understand why. And you need to figure out how before you can start worrying about why
 
@ircmaxell I wrote a little spinning heart animation in Haskell
 
11:10 PM
@ircmaxell look, my resource are limited, also I'm worried for when my online users be much
 
The thing can't manage 60fps, but it was fun and it did the job
 
@tereško ok
 
@bwoebi most code is very cold, though
 
@Sajad then hire someone who knows how to do this
fast, good, cheap. Pick 2... No. Pick 1. Actually, no, don't pick any because nothing is possible
 
@Andrea a lot of time is also just wasted because so much code is executed for every single thing. [certain frameworks] … It's not even hot code, it just sums up…
 
Anonymous
11:11 PM
@ircmaxell So to sum it up, "Learn how to learn" means, practice + RTFM?
 
@ircmaxell I undrestand what is your point ! ok !! tnx
 
@samaYo no, not just that
 
@bwoebi yeah, PHP, C, and Linux waste a lot of time ;)
 
what's RTFM???
 
@bwoebi github.com/najeira/snowflake <-- that's how to build a service...
@AnmolRaghuvanshi "Read The F*#$@ Manual"
 
11:13 PM
ok :)
 
oh god wait
 
@Andrea actually, PHP possibly could be sped up by a large margin if we had AOT analysis what the types can be and then a few specialized handlers which do not need type checking.
 
what if I ran NATO through itself
 
@samaYo learning how to learn, is learning how you learn. Learning how to better injest information and increase your skill level yourself. Learning how you can grow.
@bwoebi and I think we can do precisely that. Generate assembly for a lot of it, and then generate calls to the proxy functions
 
why all good videos are on youtube ?! there is not any un-filter website for downloading programming video ?
 
11:15 PM
I'm toying with that idea
 
<?Papa Hotel Papa Delta Echo Charlie Lima Alfa Romeo Echo(Sierra Tango Romeo India Charlie Tango_Tango Yankee Papa Echo Sierra=One);
YES
 
Anonymous
@ircmaxell Yeah, but isn't that like the million dollar scientific question? It's like asking how to learn faster, or how to ingest information better. I have asked this question since the 7th grade ..
 
Anonymous
It was rtfm + practice that worked for me then.
 
@samaYo it's a question you need to ask yourself
and that's the point I was trying to make
 
@Sajad there are some on vimeo.com
 
11:17 PM
@Andrea except it no longer compiles :-P
 
@ircmaxell alas
 
@ircmaxell totally that. It'd just need your nice tools to be implemented in C…
 
@tereško damn, it is also filter !! anyway tnx
 
from now on, this should be the standard way to pronounce PHP code
 
@bwoebi no it wouldn't
you miss why I am doing this
 
11:19 PM
@ircmaxell nice title for that video: "Failure Is Always An Option" {Like}
 
self-hosting compiler
 
@ircmaxell … to learn?
ah
 
no reason to write engines in C when you can write them in the target language.
that way you can apply the same optimizations to the runtime as the target language
 
@ircmaxell I'm wondering how you'll actually implement some dynamic features of PHP…
 
@bwoebi such as?
 
11:21 PM
Surely, a subset of PHP will be possible without too much hassle…
 
and yes, I am wondering this myself
part of it is to program the Zval structure into the code
 
but how are you going to add references, varvars etc.?
 
There's some beautiful stuff in here
India Foxtrot ("\Xray Seven Foxtrot" < $Charlie) {
 
@ircmaxell you mean the type+value combination?
 
11:22 PM
@bwoebi simple, by compiling them to assembly that looks like the current opcodes (or perhaps to the opcodes themselves)
@bwoebi no, the literal zval structure
so it can share memory with the Zend engine
that way native code can seamlessly transition back and forth to opcode
it's a horrible idea
 
oh, you still want to involve Zend…
 
but...
 
…it might work?
 
@bwoebi in the short term, until we generate our own VM specifically tailored to the target code
don't use opcode X? Don't generate it!
then each application gets a specific JIT enabled VM
yes, I am talking about a compiler which generates compilers which generate machine code
Yo Dawg!
have I mentioned I am insane?
 
@ircmaxell too meta for me :-P … but seriously, how do you want to generate that asm?
 
11:25 PM
@bwoebi which ASM?
 
manually crafting via libjit?
@ircmaxell ehm, machine code I meant
 
not 100% sure yet. Possibly via libjit, but I think we'll quickly surpass it's ability... Probably pull in LLVM via FFI and run with it
One thing I want to do is build a FFI -> extension generator that will parse classes that use Michael's FFI, and then generate a PECL extension in pure C
 
@ircmaxell oh, you mean that we code in PHP with native C bindings… and then you compile it to PECL code?
 
well, compile to whatever
 
I'm just wondering how we'd interact with returned C structs in PHP…
 
11:30 PM
ever used an FFI?
 
@ircmaxell no.
 
read up, they are quite awesome
you give them a header file and they give you back a "wrapped" API
 
oh, MFFI has TYPE_STRUCT… oh, nice.
 
yup :-)
 
so, we could with this MFFI basically change the state of the PHP engine in PHP by using bindings into the Zend core? :-D
cool
Ultimately, @ircmaxell I think, we nevertheless could try this [specialized opcodes depending on types] in the C core too. Would be quite a nice leap forward for PHP 8…
While your project sounds awesome, I don't know how well it will perform on actual code. … In the meanwhile, the core should be optimized too :-)
Sure, a self-hosted compiler in PHP would be genius, but I have a certain skepticism towards the realization of the dynamic features. … When you then link back to the Zend VM, don't know. A lot of gain is also there when you don't have to maintain a full zval structure, but just a single value…
As much as I'm hyped for your progress, I still have some doubt; so please @ircmaxell show me my doubts were needless ;-D
 
11:56 PM
have doubts!
and yes, it could be awesome to do for 8
let's get it done!
 
HAVING distance < '%s' in MYSQL is throwing over the limit, What can cause this?
 

« first day (1776 days earlier)      last day (3169 days later) »