« first day (2347 days earlier)      last day (2600 days later) » 

Wes
1:28 AM
@rlemon ah i love italy
 
2:20 AM
@NikiC thought I'd chime in with some anime recommendations as well :P -
1. Your Lie In April
2. Magi: Labyrinth Of Magic
3. Avatar: The Last Air Bender (Not Anime to be specific)
4. Haikyuu!!
5. Tokyo Ghoul
6. Kono Suba
7. Steins;Gate (REALLY GOOD)
 
Wes
@NikiC you've been infected too? noooo :P
 
no worries, you shall be as well in a while...
 
Wes
@Saitama i need to try out this anime thing for once. any suggestions for a beginner?
 
@Wes well, for beginner stuff... I'd really recommend you to something like Fullmetal Alchemist: Brotherhood, or Tokyo Gould, or Death Note, or... Steins;Gate
 
Wes
ahahahaha it was a trap, and you fell into it :D
 
2:29 AM
@Wes I should've known... shit
 
Wes
i've watched death note though. it's so stupid :D
 
it gets boring halfway through, ik
I stopped watching it after some episode like 20, or 22
Also, brb... finals o/
 
Wes
how about that thing that is now made by hollywood, with scarlet johansson
ghost in the shell
 
idk, haven't watched that
 
It looks good... but might be you know ... because Scarlet Johansson
Good morning.
 
2:33 AM
@Wes Hi, still didn't figured out how to fix scrollbar in chat :P damn
 
Wes
if it's like lucy @Orangepill not even SJ is enough to fix that
what a crappy movie :D
 
That one was pretty bad
 
Wes
luc besson always did very great and very bad movies... somehow
leon, 5th element.... and taxxi
 
looks like Lucy 2 has been announced
 
Wes
lol
 
2:44 AM
mrnig all
 
morning
 
I am really frustrated ... I cannot use the PDO extension even if i see it enabled in phpinfo
what the heck am I missing ?
 
@Valentincognito The respective driver for the DBS you're using?
Who knows. What error did you get?
 
I get the not found class error
 
PEBKAC
If I had to guess, you're looking at phpinfo() from one SAPI and trying to use another.
 
2:52 AM
no I think I know what I am doing wrong
But this goes back to class and namespace understanding
If I instantiate the PDO inside a class I created with a namespace
the namespace prefixes any other class right ?
shit I am confused
I am an idiot
I got it ^^
 
3:25 AM
strtotime() – #74275
 
Wes
stupid markdown
 
 
1 hour later…
4:38 AM
morning r11
have a happy monday..
@Jeeves what is that?
 
@Linus 42
 
5:14 AM
morning guys
 
 
1 hour later…
6:32 AM
I think there is something I don't understand about composer autoload..
 
6:42 AM
moin
 
moin Gordon
 
Wes
moarnin
 
in composer
the : "autoload": {
    "psr-4": {
        "App\\": "src/"
    }
  }
means that everything under src/ folder with the a namespace starting with App/ is autoloaded
is it correct ?
 
Wes
correct @Valentincognito but remember it should be VendorName\\App\\ and not just App\\ :P
just good practice though
 
okay but then why can't I access my src/Models/Articles.php classes ?
From /src/controllers/home.php I am trying to access /src/models/articles.php but I can't
unless: include DIR. '/../Models/Articles.php';
 
Wes
6:55 AM
in that file you should have
namespace VendorName\\App\\Models;
class Articles{}
 
it's what I have
 
Wes
put the files in some repo. did you do composer install/update ?
 
hum... do we need to update composer everytime we add a new file ?
forgive my ignorance
 
Wes
and, you should only have this in your bootstrap
require(__DIR__ . "/vendor/autoload.php");
@Valentincognito no
did composer create a vendor folder?
 
Wes
6:59 AM
did you include that file?
 
wait I will send you my repo it's easier I think
let me push the changes
 
i think you need composer dumpautoload -o
 
hola o/
 
@Wes For apps it doesn't really matter.
 
7:07 AM
I just found out that Internet Explorer doesn't support Brotli compression.
 
Wes is my hero for the day ;)
 
Wes
lol
unrelated, there is no such thing as a "model" class. model is a group of classes, so you don't want to have that as suffix :D
 
moin
 
Morning
 
o/
 
Wes
7:14 AM
\o
 
Wes
what happened to your arm
 
moin
 
@Wes Javascript accident
 
Wes
7:18 AM
lol
 
I was lucky to get out with my life
 
lol, my TweetDeck filter for "async php" yield things like this: twitter.com/Nsdknews/status/843674715453448192
 
heh yield.
 
;-)
+s
 
o/
Someone a little second to help me out with a regex?
So far I have this: https://regex101.com/r/m9bqq6/11 But I would like to use the remove all numbers After:: Verd.1 so that 1 shoudn't be highlighted :s
 
@Duikboot (?P<street>(?<= )(?:\d*[0-9\-\/]*)+)
Or instead of (?<= ) use (?<!\.)
 
oh ok :P
thx
 
7:55 AM
idn_to_ascii() empty – #74276
 
@kelunik Awesome only 1 left on line 3 that first number should be highlighted as well > <
 
nvm
 
@Duikboot (?<= |^)
 
hi guys I want to host my website in amazon but I don't know what to choose
there is ec2 and s3 but I have no idea on these which one
 
8:15 AM
Thx @PaulCrovella What can cause those: regex101.com/r/m9bqq6/13 'borders' (Really im a newbie in such regexes ):p
 
@Duikboot looks like those are marking your zero-width matches
 
@jemz , if you have a static website , you can host it on S3 . for most of the other cases, you should use EC2
 
8:29 AM
morngins
 
yo peee
 
Anonymous
mornin
 
@JoeWatkins HAPPY BELATED BIRTHDAY <3 <3
 
@Vamsi, thank you...
 
Anonymous
!!wotd
 
8:39 AM
anthophilous: attracted by or living among flowers.
 
!!dad
 
I don't trust stairs. They're always up to something.
 
morning
 
@Jimbo Oh, @Joe birthday was two days ago … I totally missed it :o … well, hope you enjoyed your birthday then :-)
 
Hi there! could anyone explain me how to build concrete DAO app following DAO design pattern ?
can't find decent (or "clear") tut about this with php
 
8:54 AM
@Julo0sS new Pdo();
 
well gordon, I use pdo, to deal with php and my db, but not really following any design pattern. I'm reading on DAO with java, but think this might be good to implement the same solution with php, can't find good tuts on that... so, looking for help here :)
 
@Julo0sS PDO is exactly that. it provides an abstraction over the database in the form of an object. it allows you to swap out the data store if needed and access the data via a universal query interface
 
ist... zermans
 
still confusing to me though... what's exactly dao with pdo? the "fetch_class" returning "objects", bindings, ?
 
@Julo0sS it's not with pdo. pdo is the dao
 
9:05 AM
ok but it looks slightly different with java for example, creating an abstract dao class (with connector or not), and then creating specific dao classes extending this dao... this is where I'm confused, can't see the relation between these "dao" approaches...
 
instead of extending the dao class, I'd recommend to use composition and inject the pdo instance
have a look at the table data gateway pattern
 
Morning
 
well, to me it sounds like the "extending dao" class (for java examples), this is where I put the sql / table specific queries in... Am I wrong?
 
Anonymous
morn sean
 
hi sean
 
9:20 AM
\o
 
@Julo0sS yes, I think so too, but you dont want to extend a database adapter. inject it instead. and then you end up with a TDG or row data gateway instead.
 
Where do you handle your PDO instance then @Gordon ?
 
Array
(
[took] => 18
[matches] => Array
(
[0] => Array
(
[id] => 261371
[name] => Large Dog at Vet Clinic
[description] => A large dog at a small animal clinic
[description_html] => <p>A large dog at a small animal clinic</p>
[site] => photodune.net
[classification] => misc
[classification_url] => http://photodune.net/category/misc
how would i return data in json form?
i try $json = json_decode($returned_content, true);
//print_r($json);

echo $json[0]->matches[0]->name;
the print works, name give error: Undefined offset: 0 in
 
@Julo0sS what do you mean by handle?
 
and Trying to get property of non-object i
any ideas?
 
Anonymous
9:24 AM
!!docs json_encode
 
[ json_encode() ] Returns the JSON representation of a value
 
new myTableGateway($pdo) ?
@Gordon well, where do you "inject" / instanciate / call it ? You send it as a parameter each time you instanciate a "tableGateway" object ?
 
if i swap decode for encode it returns this
 
so confusing to me
 
"{\"took\":18,\"matches\":[{\"id\":261371,\"name\":\"Large Dog at Vet Clinic\",\"description\":\"A large dog at a small animal
 
9:27 AM
@Wes I bet it's the eloquent crap: class Account extends \Illuminate\Database\Eloquent\Model {...}
 
@Julo0sS yes
 
so, concretely, if I need to create a "user" object, related to a db table, I'd have " User, UserGateway " classes only?
 
Anonymous
@zeddex if that's not what you were expecting, I doubt you want your data in 'json form'. What are you trying to do?
 
@Julo0sS yes
 
User gathering all the "object logic", and UserGateway makes the link between logic & persistence
 
9:29 AM
just return strings from a api
 
@Julo0sS User Gateway contains all the interesting queries to your database
 
@Gordon : yes I found your answer on stack with this link ;) but how do you manage items in relations with others (foreign keys). Your objects are independents so for example, I'll have to manage a "user" and a "group", user can be registered in several groups. UserGateway will have to call GroupGateway in its functions?
my english is not perfect, so questions may seem not clear, sorry for that
 
@Julo0sS either you inject related gateways or you just do JOINs in your queries. for the sake of simplicity, I'd go with joins
your english is fine
 
Please help me to fix this task:
1
Q: How can I make a php table page dynamically using include the table page in another PHP page?

avudaiappan Tget_table.php page which I want to make with dynamic table data.It can fetch the table data from excel sheet. I include this pege (get_table.php) from another page dynamic.php like:This is the code for only one country.but wrote this code for all other countries. //for only one country $fsave ...

 
9:47 AM
abstract class TableGateway{
    protected PDO $db;
    function __construct($pdo){
        //check if $pdo, or instanciate new pdo connection
    }
    function createObject($objectInstance){}
    function readObject($objectId){}
    function updateObject($objectInstance){}
    function deleteObject($objectInstance){}
}
@gordon does it look good for a beginning?
 
yes, but I would not create a new instance of pdo but throw an exception instead.
 
^ Agreed. Youll always want to pass in a PDO instance.
 
why that?
 
For many reasons, but here's one. If you don't pass in a PDO instance, every time you create a new instance of the gateway class you're creating a new connection.
 
this ^
 
9:49 AM
You don't want many instances (likely, untracked) everywhere
 
yea but then how do you manage pdo instances? do you create a singleton class?
 
no
you only create one (in your bootstrap file or in a DIC or factory)
and inject it
 
function __construct(\PDO $pdo) { ... }
 
I'm sorry in advance for this, but does anyone understand WP?
 
@DaveRandom Don't ask to ask, just ask. stfu when it comes to wp.
 
9:54 AM
I've been asked to speed up a site and I'm trying to figure out how (if) I can specify multiple images sizes when the images are statically served via the web server
it seems to want to route everything through PHP, which with WP will be extremely counter-productive
 
no idea. I'd assume there is some sort of wp_image_asset tags or something for that
 
@DaveRandom What does that even mean?
"I can specify multiple images sizes when the images are statically served via the web server"
 
@Gordon Yeh, you would think, but it's WP so obviously everything is routed through the_post_thumbnail(), and then horrible, horrible gd-driven magic
 
As in <picture>?
@DaveRandom Images are generated on upload though not at render time
 
@PeeHaa As in you create a post, you set the "featured image" (the one that appears magically at the top of the post and, crucially, appears in thumbnails in other parts of the site
 
9:57 AM
Yes that is generated once
Not at render time
 
obviously you need a hi-res version for the post, but there doesn't seem to be any way to upload multiple images for use as thumbnails
 
You can add sizes to be generated and change the template to use that one
 
OK I will try re-uploading some things
 
this site was imported from wp.com so I basically just unpacked a zip of things
 
9:58 AM
ooooooh
 
remember kids, @PeeHaa is our local wordpress expert. make sure to ping him if you have any trouble
16
 
That's just offensive :P
 
remember kids, @PHPeeHaa is our local wordpress expert. make sure to ping him if you have any trouble
 
But yeah at some point I tried to see how far one can go by removing wordpress parts, so I have seen horror
 
10:00 AM
Yeh I was considering just pruning the codebase
I don't think I have the energy though
Even with some very, very aggressive caching the initial PHP request takes >300ms
 
Anonymous
pruning, what a word
 
This is a PHP instance which serves other sites in ~10ms
 
@DaveRandom Wow that's fucking fast for wordpress
 
Yeh it's basically pulling the entire site from APCu
 
Really fuck wordpress.
Just look at the fucking database. Not even have to look into the code
 
10:03 AM
actually I might be able to speed MySQL up a bit, I hadn't thought of that
 
Anonymous
!!version
 
That is based on the tip of master, unless anyone has committed something in the last 8 hrs or so
 
Anonymous
when do you plan to merge?
 
I'm refactoring Room to remove some stuff that shouldn't be there, then I will be able to eliminate the Identifier layer
after that I think it can just be merged, it seems stable enough
 
Anonymous
10:08 AM
noice
 
Anonymous
Probably the safest space to start testing is System then, right?
 
@Gordon do you use "hydration" in your classes?
 
is it possible to decrease the grid lines in phpexcel chart due to it is overlapping
also the starting of data overlapps the y axis values
 
@JayIsTooCommon PluginManager and BuiltInActionManager probably
they are huge classes and I think will always be huge classes, they can't really be sanely broken up
that would be awesomesauce :-)
 
Anonymous
10:14 AM
ok, cheers :)
 
@JayIsTooCommon also Storage should be pretty safe
 
Anonymous
coolio
 
oh btw @JayIsTooCommon I did what I was talking about and I think didn't really explain very well: used bootstrap.php as the test bootstrap
that way you don't need to screw around defining system constants for the purposes of tests
 
@Julo0sS I use datamappers when needed
 
Anonymous
@DaveRandom oh nice, that'll help with !!version - Also you know how we were talking about how we publicly determine success by message posts - stackchat isn't supposed to solve that, is it? I was trying to think of a way of separating that logic but can't think of anything sane
 
10:19 AM
morning all
 
morning
 
@Gordon what do you mean by "when needed"?
so, earlier, you meant that when using PDO, all the "databaseAdapterInterface" code shown in this tutorial is useless (?)
 
@brzuchal , nice blog you got there.. mind sharing how you generated the diagrams ?
 
@Vamsi THX, I was using some online tool, I'll try to refresh my memory
@Vamsi I think this UML diagram was made in gliffy.com
 
10:38 AM
@Julo0sS there is no one single correct way to access a database. it depends on the scope of your application. you don't always need mapping to objects. a simple crud app doesnt need mapping to objects because these objects dont do anything.
@Julo0sS yes, the databaseAdapterInterface in that tutorial looks useless to me. while it's generally a good idea to have adapters to third party libs to keep control of your own apis, having one for pdo doesnt make too much sense, because its a native lib anyway. also, I'd not approach it this way, but the other way round, e.g. create the concrete pieces first, then find some abstraction when you need it.
I haven't read the whole tutorial, but glancing over it leaves the impression of massive overkill
when you use TDGs, you can simply use the arrays PDO returns and put any business logic into Table Modules. There is no need for a dedicated Domain Model then. And for most small to medium apps that are not business logic heavy, this will usually suffice and is clean and maintainable.
 
10:58 AM
@Gordon can you explain "table modules" and "dedicated domain model" ? Table modules are your TableGateway and domain model is my "User" class?
 
Hey guys
Quick q. Is static variable in class shared and not recreated for all instances of that class type?
Or only in instance scope?
 
static variables have nothing to do with objects
 
static class property
 
static class property has nothing to do with objects
 
11:13 AM
@Eugene correct. it is shared between all instances of the class
 
@Saitama Steins;Gate seems to be really popular, but I couldn't get into it. Maybe will give it another try...
 
HAhah.. hahh..ha..
 
@NikiC true.. the starting few episodes like upto 10 or 12, I don't remember, are actually very slow in pace... but it was really intriguing after those episodes.
 
6 mo project close to being scrapped because the project brief wasn;t reviewed by the stakeholders
Infact, none of them had seen it until the pre-testing demo today.
 
@Gordon okay. So in constructor I initialize static property with assoc array value, next time this class is instantiated, it will skip new memory allocation for that array, right?
 
11:16 AM
@Eugene IDK how it works under the hood. gotta ask @NikiC or any of the other deep C creatures
@Sean classic fail. why did none of them review it?
 
@Gordon The question is a bit vague
What do you mean with initializing a static property in a constructor?
That doesn't make a lot of sense
Is that meant in the sense of a lazy initialization? if (!self::$prop) self::$prop = ?
 
@Gordon Original people who wrote the brief up for us didn't bring them in to the meetings. In fact as the project lead I wasn't even aware of the people who would be reviewing it until today. I feel rather responsible for not thinking of it earlier
 
@Gordon interesting about static things, what about declaring the $pdo instance static in the abstract tableGateway thing?
 
8 mins ago, by PeeHaa
static class property has nothing to do with objects
Stahp the !!poop... please
 
@PeeHaa HAMMERTIME!
 
11:20 AM
@Julo0sS you can do that if you want. IIRC ZF1 does it that way. I prefer instance vars though. imo you dont gain anything with statics
 
@Gordon I see. Thank you.
 
Anonymous
@Jeeves that'd be messy
 
@JayIsTooCommon Yeah, I guess.
 
Nice, I've been looking for a tool like this techcrunch.com/2017/03/17/…
 
@JayIsTooCommon it's not supposed to solve that problem as it currently stands, no.
 
11:32 AM
quick Q. I get a list of IDs. like [123,32,456,4356,234,234,...]. What would be the quickest way to split those ID's into lists/array of 10 and also make each array of 10 a single string but comma seperated?
 
I've also not fully figured out how that one is going to work
s/is going to/should/
!!docs array_chunk
 
[ array_chunk() ] Split an array into chunks
 
@Austin ^
 
"should" fucks everything up, it dooms you to disappointment and regret; stick with "is going to"
 
Anonymous
@DaveRandom aye, will be nice when done
 
11:35 AM
Oh cool, so that will split em into lists of 10? Is there like a .join(',') method in php to make each length-10 array in php a comma separated string?
 
@JayIsTooCommon as I said the other day I think the fundamental problem is mixing business logic and presentation logic
I'm very sure that in most cases it shouldn't be testing for specific strings
 
Anonymous
yeah I agree, I just can't get my head around how that could be separated sanely. Though I can't get my head around many things..
 
!!> $data = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]; foreach (array_chunk($data, 5) as $chunk) echo implode(';', $chunk) . "\n";
 
[ 5.6.0 - 5.6.30, 7.0.0 - 7.1.3 ] Parse error: syntax error, unexpected '>' in /in/8flIZ on line 1 <br/><i>Process exited with code <b title="Generic Error">255</b>.</i>
[ hhvm-3.12.14 - 3.18.1 ] Fatal error: Uncaught Error: syntax error, unexpected '>' in /in/8flIZ:1 Stack trace: #0 {main} <br/><i>Process exited with code <b title="Generic Error">255</b>.</i>
 
err... wat?
 
Anonymous
11:39 AM
there is no > :P
 
well I broke a thing :-P
@JayIsTooCommon basically the reason I haven't merged it yet is because I assumed there would be a load of things like that ^ going on
 
which would change things how?
 
can't get away with a mega refactor like that without breaking stuff, and hard to find broken stuff because no tests
@PaulCrovella yeh I just realised that
 
@DaveRandom gratzi!
 
Anonymous
shouldn't that be happening for everything that uses getText
 
11:43 AM
it might be
not a lot of things use it directly I think
little busy, will look in a minute
interesting
 
Anonymous
that doesn't have a command, i'm being a tit :P
 
@Austin yw
 
nope
 
5 messages moved to Trash
 
@JayIsTooCommon I would argue that the current behaviour is the correct behaviour (w.r.t what getText() is returning) because getText() is a method of the primitive VO that belongs to StackChat, Command is an augmentation that Jeeves applies
StackChat doesn't know about commands because it's a "pure" chat API consumer with no application-specific logic
well, it shouldn't know about those things, there are probably a few remnants left here and there
 
Anonymous
11:52 AM
yeah that makes sense
 
Anonymous
no.. that's command.
 
I probably didn't make a like-for-like replacement method yet
Command should probably just override getText()
 
Anonymous
yeah, i can't see any reason for original text being required in plugins / builtin
 
Well you'd be able to get it from $command->getOriginatingMessage()->getText() anyway
Command extends ChatMessage but it's a decorator
(the idea of that was to address github.com/Room-11/Jeeves/issues/179)
I thought about it for a while and realised that every command does need an originating message, just not necessarily in the ephemeral way we currently do it
 
12:25 PM
morning
 
o/
 
\o
 
I just finished my examns and passed. I php curse has been lifted!
 
what sort of php curse?
 
PHP
 
12:36 PM
...fair enough
 
Anonymous
@Trucy Everything alright?
 
haha!
 
Anonymous
!!cancer
 
> ♋ Cancer | June 21 to July 22
An agonizing and seemingly endless disemboweling will soon show you exactly what you’re made of.
http://www.theonion.com/features/horoscope
 
Anonymous
right.
 
12:39 PM
morning
 
\o
 
tereško rīts
 
:D
 
Kay
When using password_hash function for a function that registers customers, does the password_hash function go in the controller for the register or the model (customer class) ?
 
I would put it at the point where the controller hands the data to the model. Models generally shouldn't transform data, they just need to store it
 
12:56 PM
ummwat?
 
Kay
Okay I originally put it in the register controller file like this
  if (isset($_REQUEST["registerButton"]))
  {
    $customID = !empty($_POST["customID"]) ? trim($_POST["customID"]) : null;
    $customName = !empty($_POST["customName"]) ? trim($_POST["customName"]) : null;
    $regType = !empty($_POST["regType"]) ? trim($_POST["regType"]) : null;
    $customEmail = !empty($_POST["customEmail"]) ? trim($_POST["customEmail"]) : null;
    $regName = !empty($_REQUEST["userNameReg"]) ? trim($_REQUEST["userNameReg"]) : null;
    $pass = !empty($_REQUEST["regPassword"]) ? trim($_REQUEST["regPassword"]) : null;
 
uhhhhmmm what in god's name is htmlentities doing in there?
Any god pick one
Spaghetti monster also counts
 
Kay
html entities should be removed?
 
Yes
 
Kay
Okay thanks
I saw that in an example thats why
 
12:58 PM
But more worrying is the fact that you have that in there
 
and you shouldn't be using $_REQUEST but $_POST unless you can tell me in which order it is populated
 
@PeeHaa god is dead. he was delicious.
 
Also, don't use $_REQUEST. Opens you up to all sorts of problems. Restrict it to $_POST
 
Those too ^
 
Kay
Okay ill change it to POST
Thanks
 
Anonymous
12:59 PM
Is there a cure for developers who are prone to starting a new project every 3 days?
 
Anonymous
@samayo oh, cure.
 
@samayo Termination
 
@samayo yes, step 1 is to start a new side project
 
Anonymous
@Machavity But I am sooo close :)
 

« first day (2347 days earlier)      last day (2600 days later) »