« first day (1520 days earlier)      last day (3654 days later) » 

00:48
Hey @NikiC, when will Exceptions in the Engine happen?
no idea
I'm undecided on some points
And don't have the time to reach a well-informed descision
@NikiC Which?
subclassing, really.
both subclasses of engine exceptions and what engine exception subclass (i.e. whether they extend Exception)
@NikiC Add subclasses for particularly common ones, I guess.
maybe. Though I wouldn't be a big fan of that
01:04
@Danack i) mmmhm… That'd be probably an idea… will do in the afternoon ii) you're right about utf8mb4 iii) That'd be a ctor for every property… Not sure if that'd be a great idea iv) would you write connectionString and Statement?
conn is reasonable unambiguous - but str could be either string or stream, so connStream....and yeah, Statement - abbreviated class names are weird.
@Danack in mysqli the class is mysqli_stmt … it's inspired from there.
@Danack Well, I'd never abbreviate stream… So, str is always string for me…
but probably, some basic examples would help
i've also never seen str being used as abbreviation for anything other than string
@NikiC OK, simple answer:
Make EngineException just a subclass of Exception. Pokémon can't be helped.
Don't add any subclasses of EngineException, we could always do that later if we so desired.
^ that's my suggestion too @NikiC
01:11
Sounds good. Ship it.
01:30
anyone got any idea where apt-get install libpq-dev actually puts the files?
@DaveRandom apt-file list libpq-dev apparently
though I may have misread it: askubuntu.com/questions/32507/…
@Danack Arguing with travis, will try
tnx
I don't do debian
Ugh, looks like I have to write some m4 :-(
01:57
good
.
> git commit -am "dpkg is ridiculous" && git push
Suck on that debian
I just ran gprof on my application. I spent 100% of my time in main. Shocker.
what about initialization of global symbols?
and in general time spent in kernel space
does it measure that too?
i've never used grprof...
gprof
yay, my debian sid installation finally finished
02:20
Why would you be using Sid and not Jessie?
because i want to have the latest libraries and packages in general for development
Fun fact: PHP's specified behaviour for some operators relies on undefined behaviour in C
^^
Er, not undefined, but rather implementation-defined
Such as right shifts upon negative integers
While PHP guarantees it will always be a 2's-complement arithmetic right shift... the C standard doesn't, so theoretically this is broken on some machines :D
nice one, andrea^^
@AndreaFaulds You've an odd notion of fun.
@PaulCrovella I find edge cases interesting, I'm weird.
02:28
i also think it's funny. maybe your notion of fun is odd, paul ;)
You just installed debian and I therefore do not trust your views on fun
4
xD
i like debian as a server and development platform
There are a lot of dodgy const usages in php-src
that fun fact is additionally funny, because in theory and also in practice it could break anytime on currently working platforms, because what's implementation specific could change at any time ;)
though it's rather unlikely... =/
too bad ;)
what do you mean by dodgy const usages?
i can imagine dodgy non-const usages, but the other way round?!
user3949359
are both a class and an instance of a class objects?
02:41
@foobar I'd rather use Jessie for that ^^
i've always used both for that. primarily sid and testing as a fallback if sid breaks
03:05
@foobar Just that when you build php you get about 100 initialization discards ‘const’ qualifier from pointer target type warnings
user3949359
yes, they're both objects
@DaveRandom Drives me nuts.
user3949359
So, I'm reading about instantiation of classes, and one step I cannot understand: does the computer allocate memory with a pointer when you create an instance of the class or?
If you aren't const correct somewhere it makes it difficult to know if you are const correct anywhere
well, you could do something good for once and fix it, dave ;)
software that just ignores that warning ain't really reliable to me
i don't really get your question, nosille. is your question if a class instance is allocated on the free store or on the stack (if available on that particular architecture) ?
because a point can point to any arbitrary memory location. it has nothing to do with the way memory is allocated
pointer
user3949359
03:16
@foobar I'm not even sure how to define my question, all I know is that it's not clear to me.
user3949359
Say, I instantiate a class, what happens in the background in the memory?
user3949359
How does a the class itself take up memory
user3949359
?
well, i can't answer that question for php in particular. i'd have to check the source for that, but i guess someone else here might be able to answer that question
user3949359
the source is MIT opencourseware, the CS introduction lectures
user3949359
03:18
Unfortunately, they teach Python
user3949359
But I'd like to get a grasp of how it works in PHP, Java as well
well, sorry but i can't answer that for neither php nor java
the most efficient thing you can do is to allocate a continuous region of memory either on the free-store or the stack, providing enough memory for the data members and a reference to a table for the virtual function dispatch in an inheritance tree
user3949359
I want to know how the language uses up memory
user3949359
it's not always the most efficient solution
the data members itself can either be a pointer to another memory address or store the actual data in a continuous way itself
but there are also other ways to manage that
you could for example use a linked list of nodes for each member providing the type of a value in a dynamic language and a pointer to the value itself. it would be quite inefficient, but also a possible solution
and there are more...
but i can't tell you which approach is used by php or java
user3949359
03:27
I was thinking about a linked list as well
user3949359
Ok, another question I have is about callback functions
if you want to know how it really works in the special case of php or java, you either have to check the source or hope that someone else here can provide you with the correct answer
user3949359
Say, I have a callback function passed as an argument. By definition, it has to execute after the parent function, but does it always trigger after the body of the parent had been run?
but linked lists are almost usually bad
you have to chase a lot of pointers, making it hard for a compiler to optimize and fucking up the pipeline
user3949359
what are you referring to as the pipeline?
03:30
the instruction pipeline in a cpu core
well, when you pass a function as argument, it could be called at any time
it could be the first thing called within the function to which you pass it
it could also be the last thing called
and it could also be called after that function finishes at a later point in time
basically it could be called at any time
all of these things are common
for example when sorting a sequence
you could provide a function to the sorting function, defining the sorting criterion
in that case your function will be called several times before the called function returns
but it could also just be a function to register it as a callback
then the called function won't execute the function itself
but instead a different function will execute it later
user3949359
My question is whether a function called at the end would qualify as callback
yes it would
user3949359
or rather, called at the beginning
it would also qualify
user3949359
prior to the body being executed
03:37
well, that's impossible
it can be the first thing to be executed within the body
user3949359
why?
but it can't be executed before the body starts
else you won't pass a function
user3949359
didnt make myself clear
user3949359
Yes, I mean the first thing in the body
user3949359
Another thing I don
user3949359
03:39
t
user3949359
quite get is they hype around MVC
user3949359
MVC is the "duh" of web dev, why do people obsess over it?
sounds nice. i wished that had been around some years ago
but will have to read the whole rfc later
sorry, but i can't answer that question, nosille
user3949359
I know, it's not clear
user3949359
03:42
It's not a specific question, just wondering
well, it has its benefits
and is not only used in web development
it makes it easier to maintain your code base, reuse code and allows you to replace big logical parts of your code without breaking anything else
user3949359
I think it is good, I just don't get why people emphasize on it. Of course there is view, controller and model. There always (exaggerating) have been.
user3949359
There'
user3949359
have always been databases, front end and something in between bridging them
well, sticking to mvc i can do things like writing a graphical user interface using windows forms and gnome or kde
all i'd have to replace is the user interface code as it's not intrusive
user3949359
03:48
It's like you have a body, but your body has discrete separate organs, which are connected by the CV system.
but the way in which i represent my data and handle it can stay the same
user3949359
I see
and i don't have to fiddle with the code because model, view and controller are clearly split apart
but well, eventually andrea knows how class instances are organized in memory
user3949359
Is it in the article above, or what?
no
but as she's here, you could ask her if she can tell you how php organizes class instances in memory
user3949359
03:53
That would rock
user3949359
Are you used to PHP hooks?
me or andrea?
user3949359
she's not around, so..
nope, haven't used php for years
user3949359
OK
03:57
hi
there she is ;)
user3949359
Greetings
what part of how class instances are organised in memory were you wondering about?
user3949359
So, I;ve been watching this lecture, and the professor said the instance of a class is going to use up memory and place a pointer in there
user3949359
How does that work?
user3949359
04:00
Does it have a pointer for itself and then a pointer leading to the class and that's it?
user3949359
what does an instance memory chunk consist of?
are you actually talking about the this pointer?
user3949359
i think the guy meant a pointer to itself, like an access path
If I do $x = new FooBar();, the C value representing $x will have a pointer to the instance of FooBar somewhere along the way
(actually more complicated than that, but basically it works like that)
04:02
well, a class instance doesn't get a pointer to itself, but when you call a member function, that function will implicitly get the address to the object passed which will be available as "this" in most languages
not sure if that's what you mean
@nosille lxr.php.net/xref/PHP_TRUNK/Zend/zend_types.h#_zend_object (that's PHP 7, PHP 5.x is more complex)
user3949359
@AndreaFaulds so the variable you're storing it in will be linked to the instance, which will then further lead to the class. Fair enough, but how does it look like in memory?
Okay, I can show you that.
wiki.php.net/phpng-int#is_object <-- look at these diagrams
user3949359
I don't get the idea of the first link
The first is how the variable looks in memory, the second is how the instance looks
user3949359
04:06
so the node will be a combination of both, or more complex?
So, um, the run-tests.php that gets generated when you build an extension doesn't exit with a non-zero code when there are failed tests
???
@nosille Er, the variable looks like the first bit, the instance it points to looks like the second.
@DaveRandom >generated - what?
user3949359
@AndreaFaulds How does a class object look like in memory?
I... don't know. Does phpize create one?
@nosille Do you mean the class itself or the object?
user3949359
04:09
@AndreaFaulds the class itself is an object
@DaveRandom I dunno, I'd just use the run-tests.php that PHP uses?
@nosille Not really, it's a struct. C doesn't really have objects, and PHP is implemented in C.
Trying to make a sane travis env, could do with avoiding dirty hacks, but might have to
@DaveRandom Maybe there's a flag...
user3949359
@AndreaFaulds I used to believe the same, that only the instance of a class classifies as an object, but I was wrong.
@nosille In some languages like Python, classes are objects. They're not in PHP. In terms of how PHP works behind-the-scenes, classes aren't implemented with objects either.
user3949359
04:13
@AndreaFaulds yes, it probably has to be a pure OOL
@AndreaFaulds That's what I was thinking, but if there is it's not documented. php-src doesn't seem to pass one, either. And yet... travis-ci.org/DaveRandom/pecl-database-pq/builds/43975905
@DaveRandom Hmm...
user3949359
@AndreaFaulds So, back to my point about how a PHP class looks like in memory.
@DaveRandom php-src passes -g
I'll try that, but it's not documented as doing that
04:14
@nosille Something like this C struct: lxr.php.net/xref/PHP_TRUNK/Zend/zend.h#112
user3949359
Thanks
@DaveRandom Oh wait, -g is just what's shown, hmm
Trying it now
user3949359
Is a class an object in JS?
Maybe it's REPORT_EXIT_STATUS=1?
AHA
Yes it is!
run-tests.php checks for that environment variable
04:17
ahh that'll be it
ty
I think ustring needs that as well then
@AndreaFaulds inorite
/me -> sleep (hopefully)
night
good night
nn
me too, actually
user3949359
04:24
Is it a good idea to have a class collection with instances of another classes?
04:57
@nosille , mm?
user3949359
05:18
@sectus pardon?
05:43
@nosille why not?
user3949359
@sectus I'm not sure what you mean
It's common idea to have a class collection with instances of another classes.
user3949359
ok
user3949359
It came as a shock to me and also passing instances as arguments was weird.
user3949359
06:07
@sectus Are you familiar with PHP hooks?
06:28
@nosille , passing instances as argument is good approach. en.wikipedia.org/wiki/Dependency_injection
PHP hooks... it's procedure language approach. Is it?
user3949359
well, I read in another question over her in SO, that hooks are like add-ons on the existing framework, like plugins
user3949359
Employer asks me to make a hook, and I sort of know what it does (I know how to make it since I have a template), but I'm still not deeply familiar with the concept
user3949359
"A Hook is a collection of callback functions that enable us to intercept the page life cycle."
user3949359
I don't really know what to make out of this
06:43
Hook is procedural approach. You could replace, or wrap procedure with another procedure.
user3949359
I still don't get it
Is Employer a programmer?
user3949359
yes
Does hook system exists in your application?
user3949359
yes
user3949359
06:53
hold on
use it.
Simple idea of hooks: 3v4l.org/L40nl
user3949359
I got the code, I just need further clarification
user3949359
<?php
namespace application\example\hook
{
use application\nutsNBolts\base\ControllerHook;

class Blog extends ControllerHook
{
// Added new function to be triggered on page init
public function onInitPage($page)
{
//check whether the user has signed in.
if (!$this->plugin->Auth->isauthenticated())
{ //if not, send him to the signin page
$this->redirect("/signin");
}

//
$post = $this->plugin->Mvc->model->Node->getWithParts([
'content_type_id' => 3
]);
$totalPost = count($post);
//we have +1 elements more than indexes, since the array starts with an index of 0
user3949359
here's one of the hooks
user3949359
i
06:55
i have created a database on server
Ask your employer for help. Or someone who know your API. Your hooks are part of internal API.
used this php code to insert value
i inserted value 'hello'
this is successfully inserted
then i inserted 'नमस्कार'
it is inserted as
&#2344;&#2350;&#2360;&#2381;&#2325;&#236
can anyone pls help
user3949359
@sectus It's a form hook, it takes care of form verification, checks whether the user is allowed to submit the form (i.e. signed in).
pls anyone help
user3949359
07:10
@UnityBeginner This probably has to do with the encoding settings of your table
user3949359
or the collation as they call it
i tried somuch
can you help pls
user3949359
what language is this?
hindi
i tried this code also
14
A: Storing and displaying unicode string (हिन्दी) using PHP and MySQL

ROSE<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <?php $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_query('SET character_set_results=utf8'); mysql_query('SET names=utf8'); mysql_query('SET character_set_c...

but didn't work
can you pls help
user3949359
you're using MySQL, right?
user3949359
07:12
ok
yes
17 mins ago, by Unity Beginner
http://pastie.org/pastes/9779480/text
user3949359
go to the table and look up under "collation"
ok
@nosille utf8_unicode_ci
can you see this problem 1 time on teamviewer
this you may solve in 2 mins bro
@nosille
user3949359
@UnityBeginner Honestly, I don't know how to solve it
user3949359
I'm just guessing
07:17
ok
14
A: Storing and displaying unicode string (हिन्दी) using PHP and MySQL

ROSE<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <?php $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_query('SET character_set_results=utf8'); mysql_query('SET names=utf8'); mysql_query('SET character_set_c...

i found this
but not able to use it correctly
user3949359
I would suggest to play around with different collations, there should be a hindu one, see if it displays properly
ok thanks
user3949359
sure
user3949359
there are a million collation options, one of them has to work out.
bro i found utf-8
i tried that but it didn't work
anyways thanks
anyother php dev
can anyone suggest pls?
 
3 hours later…
10:21
mornin'
user924016
10:41
mornings
Mornin'.
Maaarning
Hoopy sundae.
10:57
@AndreaFaulds Yeah, that's probably the most realistic approach
11:43
@UnityBeginner MySQL sucks and what you actually want is utf8mb4 in MySQL
@NikiC Do it!
11:55
( ! ) Fatal error: Call-time pass-by-reference has been removed
$member_id = 11;
$k=10;
$similarities = 100;
$ksim = $obj->member_k_similarities($member_id,$k,&$similarities,$cat = 1);
var_dump($sim);
any help here to solve?
@Code You can't make it a reference at call-time, foo(&$bar) isn't allowed
But you can make the parameter be by-reference, e.g.: function foo(&$bar) {}
Also, why are you assigning $cat to 1?
@JoeWatkins yo
its default
I done a 10 minute screencast, looking for reviews ... anyone got a bit of time ?
12:02
@Code Is that a function call or a function definition? To use a parameter's default value when calling, just don't pass that parameter
@JoeWatkins ok sure
there are images missing, haven't done them yet ... imagine they are there ...
@AndreaFaulds thanks
@Code also lemme explain the reference thing: because the parameter is marked with a & in the function definition it's always by-reference, you don't use the & when calling
allow hinting resource
So just do: member_k_similarities($member_id, $k, $similarities);
12:05
alias integer int, double float ...
@JoeWatkins that'd prevent getting rid of resource, so no
ah ... perhaps ...
@JoeWatkins integer and boolean maybe, but I want double to die
we allow cast tho
looks good
@JoeWatkins I honestly want to get rid of that cast. Especially if bigints are added due to confusion
@JoeWatkins No audio?
12:08
there is audio yeah
Hmm
No audio for me, maybe because iPhone
hmmm ... should be mp3 audio ...
Yeah, weird. I'll watch it later on my laptop.
thnx
[libmp3lame @ 0x14d6200] Channel layout not specified
woops ... might be that ...
12:20
desktop should figure it out, mine did ...
dunno how to set it ...
12:43
@JoeWatkins discovered last night that ustring travis builds won't fail if a test does not pass, you need to set an env var otherwise it will still exit with 0
@AndreaFaulds does it work now ?
user924016
Listening to it now
when did you load it ?
user924016
4 min ago
can you try reloading it and skip a few minutes ?
user924016
12:48
sure
my video player won't play it for some reason now ...
changed from mp3 to vorbis ...
user924016
works fine here still
Inaudibly low volume for me
user924016
running in chrome
room topic changed to PHP: Discussion for all things PHP, and stuff. Chat Guidelines : room-11.github.io [php]
12:52
aww, no more tie talk :(
Feel free to pick the discussion up again :-P

« first day (1520 days earlier)      last day (3654 days later) »