« first day (1666 days earlier)      last day (3273 days later) » 

3:00 AM
@BrianS here's a tutorial of how to do it without a framework github.com/PatrickLouys/no-framework-tutorial ... it'll show you how to do many things a framework might do
@BrianS I don't think any regular devs here are going to recommend one over the other
 
@BrianS Laravel and Symfony are the most popular ones and have quite a lot of support, they implement quite a lot of the architectural patterns that you'd like to use
I use some modules from Symfony and stuff
but @BrianS learn what Composer is and how to use it to combine components, that people have written, and you'd be much better than limiting yourself to a single framework
because most of the frameworks try to do the same things in different ways
so maybe some of them are flawed at some point of the architecture, others at other point
 
any one workd on codeigniter?
 
@BrianS Here's the one I wrote: github.com/funkytaco/php-mvc-bootstrap but I don't support it. Might be really horrible, too. Haven't used it in prod or anything
 
@ziGi wow this subject is so complicated
 
it's like choosing between an apple with a worm in it, or an orange with mold in it, but you could always cut the good part of the apple and the good part of the orange and mix them
 
3:03 AM
anybody to help me in codeigniter?
 
MVC isn't really hard. M = Model (your DB admin designs it), V = View (your UX designer designs it), C = Controller (your back end engineer engineers it) ...... And if you work alone you handle them all!
 
I know how to work with wordpress and create plugins...but now i want to learn to create my own web application. What is the best way to go about this?
 
@BrianS choosing a framework is like choosing between an italian car or a german car in the case of the italian you have the nice looks, the german has nice architecture, but it would be nice if you can have a car with italian design and german architecture, wouldn't you?
@taco taco I do fullstack :D
 
Web applications like hootsuit, Wikipedia, Facebook etc
 
@BrianS do you know HTML/CSS at least?
 
3:05 AM
even some system administration
 
Yes @taco
 
Are you sure you want to be a PHP dev and not something else?
 
i have a issue , that whenever i am searching with some value in form the results are coming fine but when i go to next page in search results then the default query is running instead of query with search term ??
 
@taco yes, i see the power in PHP a lot
 
I'm not really good with PHP since I know maybe ~30% of the available functions provided by PHP, so whenever I need to do something I just check if functions exist. But knowing how to do OOP well and good coding style and architecture helps a lot more
 
3:07 AM
@zigi yes exactly i want to learn OOP, but it keep referring me to framework somehow
 
I think it's too soon for you to learn a frame work. Learn OOP first
 
@taco Okay Thanks, Where is good to learn?
Oh Thanks
 
the manual page up there^
 
good point taoc
 
and it will be easy
you will enjoy yourself much more
 
3:09 AM
@taco Thank you man
 
once you learn that, you will pick up frameworks without any problem
 
@taco do you recommend any prerequisites to learn OOP?
 
well, maybe not without any problem, but less teeth pulling
 
@taco I've came to the realization that the OOP they teach in schools and Uni has nothing to do with knowing how to make a well structured application, it's more about what are the capabilities of OOP, but it excludes patterns
 
I don't like school, they always teach wrong and outdate info lol
 
@BrianS PHP.net is very useful.
php.net/functions , classes and objects, etc (it's all there on the side menu)
 
Thank you guys this help a lot
 
really nice simple examples with pictures and code
I like Net Tuts for beginners a lot
 
You can search the website by typing something in the URL, i.e. if I wanted to search for the word "for" php.net/for
I think I bought a bum speaker on eBay
 
3:14 AM
Also you could do some programming experiments at CodeAcademy codecademy.com/courses/web-beginner-en-ZQQ64/0/…
 
Thanks, by the way Facebook sucks
 
haha
 
This is what made me to want to master PHP now
 
I should say I think I bought a bum, super expensive speaker on eBay
 
I hate how you cannot disable the "Seen" message from the chat, totally takes your privacy and throws it in the trash
 
3:15 AM
fucking a, man. Guy had 0 rep. I should've known better
 
a bum, like an ass?
 
Yeah, it's pretty much ass
These Beoplay A2 speakers are supposed to have a battery life of 24 hours
This thing is dying within an hour or so
 
I really like how you buy something on eBay and they send you bricks over the post
 
heh
I shot mobile video to be sure
due to guys rep
 
@taco maybe the battery was ok but the guy fucked it and wanted to get rid of it
 
3:18 AM
what
what do you mean
are you joking :d
Either way the guys an idiot. He only put $50 insurance on it, then USPS about lost it
 
No, I had a similar experience. People buy stuff, don't recharge them properly and the battery fucks up over time and they sell it as ok, but the capacity of the battery is totally screwed
 
Point 2 proving he's an idiot. These things have 2 year warranties. He should've tried to get it replaced
3 years if he bought it online
 
how much did you pay for it?
 
Aaaaaaand it cut off. God dammit. Fuck this guy.
$280
It goes for $399 new
 
yeah, damn, why is everything so much cheaper in the states
here in the Netherlands it's like 350 Euro
 
3:22 AM
Dunno
 
oh, no, it's around the same price
haha, wow, the euro has dropped quite a lot, I haven't noticed
 
Ok gonna charge it overnight and if it does it again, gonna have this POS sent back
 
sure
I am going to bed guys cause it's already 5:20 in the morning here
enjoy the rest of your day, you delayed people
 
wow
g'night @ziGi
gonna pop over to js room then
 
morning
lol i am getting headers already sent error :D
 
3:27 AM
I also started a Docker room if anybody wants to idle there :d
 
3:39 AM
@tereško It just means extract the ID from the User object and pass it to the function I already defined that takes a User ID and returns a User object.
@tereško How can you guarantee that the data exists before you are querying it from the database?
 
 
4 hours later…
ThW
7:20 AM
morning
 
7:50 AM
morning
 
hello.. world?
 
8:13 AM
Hello World
:D
@z
@ziGi morning
 
8:45 AM
@Sara I don't think I'll have time to prepare for something like that
Next month will be very stressy
If that's even a word
 
morning @StephenWolfe
 
9:25 AM
@ziGi would you happen to have an educated opinion on how best to decide on choosing a framework to develop on or go bespoke for a large system
 
how do you define large?
like Enterprise systems or?
 
@ziGi if it was planning on being a social platform say 2 mill users
 
Well it's not about the framework, it's about the way you think
 
@ziGi I was thinking use a framework for rapid prototype.
 
I work at a company where we have a lot of data and modeling so we use Domain Driven Design
as a practice to separate and model the domain in a more explicable way which is also easier to explain to the financial guys who understand what's happening with the business logic
@StephenWolfe if you want to make it scalable
 
9:28 AM
@ziGi i have never herd of that...
@ziGi should i read up on it.
 
you should definitely use a combination of a document database and relational database
@StephenWolfe yes but it takes time to wrap your head around it
 
@ziGi well i definitely wanted to separate out different parts of the system for redundancy.
 
for example facebook used to keep their data on MySQL and use a lot of cache but it became a problem
@StephenWolfe the thing is that usually users have much more requests for reading data than for creating/editing
 
@ziGi yeah
 
so many times it is a good idea to keep your data prepared for reading (denormalized and parsed)
so you can immediately display it
instead of building objects on the back end, filling them with data and then parsing them to the front end
 
9:33 AM
@ziGi yea I will be pulling a lot of data in as well that will need to be cached
 
basically try to opt for a NoSQL database
and do loosly coupling in the RDBMS
 
Morning
 
morning
@StephenWolfe I can suggest you take a look at CouchBase and TAO
 
@ziGi cool and what about domain driver design
 
Domain Driven Design is not a necessity, it's more of a terms that people created to say that you have a layer of your application where you model objects after the real world and think more about how they interact, rather than starting to think how the data is going to be persisted
 
9:42 AM
ahh okay
Right I need to research these
 
it's more of an ideology with a few elements
about how to achieve it
 
If I want to build a rapid prototype should I try to follow these?
 
I am not sure what you are referring to as rapid prototype
are you talking more about the style of development
 
Just like if I want to build something really quick
 
yeah fine
but that's more for proof of concept
where you make something quickly to see if it's going to be viable
 
9:45 AM
yeah to show investors
:D
 
yeah
well if you want to do that
you can
 
I dont want to build at too much technical debt by building it wrong though
 
and then I suggest you use a framework because it would save you time
but when you start the real development don't base yourself on a framework
 
ahh thats what I thought
So i would have to go back to the start
 
so make a prototype fast using a framework with the core functionality
but then start all over with the right technology
@StephenWolfe not necessarily
since you'd have a better idea of what and how things should work and you can model it in a fast manner
 
9:49 AM
great
 
haha, are you hyped
anyways
the backend is separate from the frontend
so you could reuse the whole front end
I usually like making the application using a front-end framework of some kind and make the back end a REST-ish kind of API so they are separate and interchangeable
 
gtg
cheers zigi
 
sure, enjoy your day
I am going to the beach too soon
 
10:03 AM
hi
 
oi
 
10:58 AM
from phpuceu with @Gordon and @ThW :D
 
Anonymous
Wow really your answer is just 1 security breach. There is no need to escape input anymore??? What about xss attacks... You should always sanitize user input.. — andy Mar 18 at 11:50
 
@andy What the hell are you talking about? This question is about escaping for sql. Not about password hashing, CSRF prevention, XSS prevention or fire hazard prevention — PeeHaa 3 mins ago
 
Anonymous
lol
 
Anonymous
or civil unrest ..
 
:P
 
12:29 PM
waves at @ircmaxell while he's on the big screen ;)
 
MGE
Hello, using this, I can get records
AND timestamp > 1430595837
but if I use timestamp > DATE_SUB(1430595837, INTERVAL 1 DAY)
I can't get record for that day
 
hey guys
 
MGE
timestamp > UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 30 day))
it works, but I want to use custom date insted of now()
 
MGE
1:08 PM
0
Q: Use custom timestamp instead of now() in sub_date

MikMikWhen I use: timestamp > UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 30 day)) it works, but I want to use custom timestamp date instead of NOW() timestamp > UNIX_TIMESTAMP(DATE_SUB(date('Y-m-d H:i:s', 1430595837), INTERVAL 30 day)) But it doesn't work properly. How can I place custom date there?

 
1:21 PM
@Gordon :-)
 
@LeviMorrison how is any of this related to anything we were talking about ?
and you still haven't shown any code
either show some code or shut the fuck up
 
@tereško easy there
 
we have bee at it for two days now
I am a bit fed up
 
2:05 PM
5869 classes, without dealing with letters
 
@tereško I described the code already.
And the question about what to do on missing data is relevant because you have no clear way to communicate the missing data in your API.
 
I wasn't asking for description of the code
$user = new User;
$user->setId(42);
if ($mapper->fetch($user)) {
   // user was found
}
22 hours ago, by tereško
in my case, fetch() and all the other public mapper's methods return a boolean for checking if operation was successful-ish
.. so, show the code of stfu
 
I can show you the code but I can tell it won't matter. You have a preconceived notion of what you think is correct based on your interpretation of Fowler's work.
You wouldn't even admit that is Mapper is, in fact, a mapper in the traditional CS sense.
 
I admit it , but you seem to convinces that "Mapper" has to create shit
 
Can someone help me with this please?
http://pastebin.com/VjP0HnwS
 
2:16 PM
@tereško I've told you many times it doesn't.
Why do you keep on insisting I think it does?
 
from the single line that you have shown, that is the only interpretation that I see
3 mins ago, by tereško
.. so, show the code of stfu
 
@tereško echo "stfu";
 
anyone?
can anyone help?
 
@LeviMorrison oh, come on… :o
 
@tereško Why do you want the API consumer to create the User class when it is guaranteed to be incomplete?
I can do it the way you want but it's incredibly sub-optimal.
 
2:27 PM
I am not discussing this with you anymore
 
wow I can't believe this .... I need to connect through windows rdp to a ubuntu vps
 
@tereško You were never discussing it in the first place.
You can live your life however you want. I think you may want to consider why you even visit here if you can't discuss things at all, let alone politely. Do you just like swearing at people and arguing with them because they think differently than you?
Even when they bring up well-established and well-founded theory that isn't even their idea?
You wanted to know how my design works, supposedly, but then you won't let me change the API because of some notion you won't defend.
 
you can be all self-important as much as you like, but initially I was polite when I was asking to you to show a code example of what you were talking about
I was polite the second time too
 
As was I.
 
after asking ~10 time fo you to show the code, I am kind pissed of
 
2:34 PM
Code is not the all important factor.
The design is.
 
lol
 
So no, I can't give you code when you won't tell me why the API consumer is making a User object that is guaranteed to be incomplete.
Why do you want that?
 
"the API consumer is making a User object that is guaranteed to be incomplete"
I dont even understand what you are talking about
 
$user = new User();
$user->id = 42;
You can't use that User class for anything except retrieving a User from the database
So why make an incomplete object?
Why not just pass the id?
 
$user = new User;
$user->setName('Lorem');
$user->setEmail('who@cares');
$mapper->store($user);
 
2:38 PM
Storing is not necessarily the same as fetching.
 
> You can't use that User class for anything except retrieving a User from the database
Also, didn't just say:
> Code is not the all important factor.
 
Yes, I did.
I was asking about design.
 
then why exactly are you trying to pull apart those few lines if they are jhust code
 
Asking why you create a guaranteed incomplete class to perform a fetch is a design question.
 
show me a good example where it is "done right" or SHUT THE FUCK UP
if you are not capable of that, then please stop this pointless bullshit
 
2:42 PM
The land from which I hail prefixes such bool-return-hydrator methods with try* in order to separate them from methods that throw when they fail to fetch or store. $0.02.
 
@DanLugg that's reasonable when you have two different possible scenarios
 
3:00 PM
@tereško See, this is exactly what I'm talking about.
You don't want a discussion.
I gave you the theory that can be quite literally translated into practice and you wanted nothing to do with it.
So I asked you about your design and why you want it that way.
And you respond like you just did.
// Map a UserId to a User or null
$user = $UserMapper->fetch(new UserId(42));
if ($user !== null) {
    // do something with User
}
This doesn't have incomplete classes anywhere. And no, the UserMapper doesn't have to make the User object (it can come from any kind of data store).
 
According to Eric Evans if you use a repository the repository should create the object via a factory, According to Martin Fowler PoEAA the example is the following: pastebin.com/BKMNirGW
as you can see, clearly the mapper creates the object
btw I think mappers are a bit odd because they do ask instead of being told
I hope that settles it and there could be peace
In martin fowler's example even if you use loadAll it creates an ArrayList inside the Mapper and populates it with DO's
 
3:18 PM
@LeviMorrison btw, I don't think c99 compound literals will work for zend_string
 
3:34 PM
@ircmaxell because of dynamic sizes and zend_string* using struct hack?
 
right
 
Also, we'd need to calculate hash value at compile-time, else it'll break when php tries to change data segment at runtime…
 
ya
 
with constexpr it'd be definitely possible, but not sure if C99 is good enough for that.
[I doubt it]
But if you have some macro to calculate that at compile time… then we also can just build a big string from it and cast to (zend_string *)
 
can macros actually do string operations at compile time?
I mean that sounds like a compiler optimization pass if anything
 
3:44 PM
I have no idea. You can sometimes do the weirdest things with them^^
 
4
Q: preprocessor functions evaluated at compile time in C

highBandWidthI want to write preprocessor functions/arrays that are evaluated at compile time. For example, if I define #define MYARR[] {5,4,3,2,1,0} then, the code int x = R[0]; should be presented as int x = 5; to the compiler. (of course only literals can be used in the index). This is important i...

 
@ircmaxell stackoverflow.com/a/3791541/2153758 … I know. But the issue is to loop in a macro.
We maybe could abuse binary expansion for that…
(like having a ten of macros which call each other twice…)
 
lol
 
not joking…^^
But that's what I mean with weirdest things^^
it's all just constant dereferencing and casting
 
4:06 PM
how can I stringify the result of a constant, non-literal integer value in C?
e.g. having #define MY_VAL (2 + 2) … how can I stringify this to "\0x4" ? :-/
 
what's "\0x4"?
you mean \x04?
(char) (2+2)
 
No… I mean I want e.g.

#define START (2 + 2)
#define END (3 + 7)

what I want to get: "\x4\xA"
@ircmaxell uh, yes, \x4 ^^
 
ah
(char[]) { (char) START, (char) END }
 
hmm
Am I able to also append a ## string to it? (the zend_string* case)
 
4:22 PM
I don't think you can append array/strings
 
oh, yes surely I am…
I just can deeply nest that thing
 
yeah
 
hmmm… :-)
 
@ircmaxell @bwoebi Dynamic sizes are not an issue.
I am unsure about the hash value, though.
Certain operations can be done at compile-time, but in C it's less clear which ones are possible.
 
@LeviMorrison yeah, the hash value is the issue…
 
4:25 PM
We can possibly do it with recursion.
 
@LeviMorrison also… have fun converting the size.
yes… that's exactly what I was trying to solve.
 
What do you mean, converting the size?
Growing a zend_string that's static?
That wouldn't be possible – they'd have to be const.
 
wait.
@LeviMorrison why are dynamic sizes not an issue?
 
I don't know what you are talking about: lxr.php.net/xref/PHP_TRUNK/Zend/zend_types.h#149
 
will it still work, even with struct hack?
oh well, I'll have to actually try compiling it.
 
4:29 PM
This mostly comes down to the fact that C is quite permissive.
So what you do is create an inline struct that is equivalent and cast to a zend_string.
I believe NikiC already has demo'd this; just a second and I think I can find it.
 
@LeviMorrison oh, great idea…
 
Dec 22 '14 at 22:03, by NikiC
#define ZEND_STRING_CT(str) \
    (zend_string *) (struct { \
        uint32_t refcount; uint32_t type_info; \
        zend_ulong h; size_t len; \
        char val[sizeof(str)]; \
    }[1]) {{ 1, IS_STRING | (IS_STR_PERSISTENT << 8), 0, sizeof(str)-1, str }}
 
just hash value needs some hack then?
 
I think so, yes.
 
good.
 
4:32 PM
This is one case where C++ would be so much easier :)
 
or rather where some tools are missing in C…
 
I'm not sure why C hasn't received more powerful const expressions.
Maybe just a lack of interest on the part of the committee.
 
@bwoebi yeah, hash is a problem if compound literals are placed in rodata as well
But I'm not sure if they are
@LeviMorrison I'm not sure it would in this particular case
 
I think constexpr's would work here.
I guess we'd just have to try it.
 
As C++ has no compound literals
 
4:37 PM
It has initializer lists though.
 
But just having constructors for globals is already pretty good
HHVM has staticStrings
You have to declare them as globals, but still better than what we do
 
Link to our main string hashing function?
@NikiC In C++ we'd probably just use a custom allocator and put the string right after the zend_string object.
It's an extra word of space, sure.
Is that extra word really harming performance?
I really mean that since it could, potentially.
I guess it would affect alignment too.
I guess custom allocator still doesn't work at compile time :)
 
@NikiC They work as locals as well, it just tends to be a bit silly to do that, since you can avoid runtime cost by only initializing it the once.
A static local would make sense, I suppose. But it's psuedo-global at that point anyway. :p
 
Yah, best not listen to me when I say stuff about hhvm ^^
 
@NikiC :p
@NikiC btw, did you see my poke yesterday?
 
4:52 PM
@Sara I noticed that hhvm strings store a char* (but seem to still use the struct hack layout). why is that?
8 hours ago, by NikiC
@Sara I don't think I'll have time to prepare for something like that
 
@NikiC Edwin is the one to poke about that.
@NikiC How about if I gave you my slides?
But cool. Just thought I'd ask.
You're the best qualified to talk PHP extensions atm
 
I don't think it'll work @bwoebi
 
@Sara hrm, how likely is is you're not going to be there?
 
@NikiC atm, it seems extremely unlikely
 
awww
 
4:54 PM
typedef struct _refcounted {
    uint32_t refcount;
    uint32_t type_info;
} refcounted;

typedef struct _string {
    refcounted gc;
    unsigned long h;
    size_t len;
    char val[1];
} string;

#define LITERAL(c, l) ((string) { .gc = {0, 0}, .h = HASHOF(c, l), .len = l, .val = c})

#define HASHOF(h, l) (HASHOF_##l(h, 0, 0))

#define HASHOF_3(h, n, r) (HASHOF_2(h, n + 1, HASHOF_1(h, n, r)))
#define HASHOF_2(h, n, r) (HASHOF_1(h, n + 1, HASHOF_1(h, n, r)))
#define HASHOF_1(h, n, r) ((r<<5)+r+h[n])
 
erm, unlikely I'll be there
Since that statement was ambiguous. :p
 
@bwoebi that compiles, but it warns and only stores the first character of c
 
@ircmaxell Are you trying to hang the string off the end of the struct? If so, then assigning val=c is probably not what you want...
 
right, got that ;-)
 
@Sara that might work
27 mins ago, by Levi Morrison
Dec 22 '14 at 22:03, by NikiC
#define ZEND_STRING_CT(str) \
    (zend_string *) (struct { \
        uint32_t refcount; uint32_t type_info; \
        zend_ulong h; size_t len; \
        char val[sizeof(str)]; \
    }[1]) {{ 1, IS_STRING | (IS_STR_PERSISTENT << 8), 0, sizeof(str)-1, str }}
You gotta do the decay-of-temporary-struct-array thingy
 
4:59 PM
well, from what I see, that's a syntax error (expecting a ; after the } closing the struct
 
@NikiC How about I send you want I have and tell the organizers you're a maybe, but you haven't comiitted to anything.?
 

« first day (1666 days earlier)      last day (3273 days later) »