« first day (918 days earlier)      last day (4255 days later) » 

14:00
.. for the reason described in the line right after that one
When I load a Customer or Courier object I either have to load their Town object in the mapper and setTown($town) or else replace that Town object with a TownProxy which implements a Town interface and it will only load the Town data if I need it
what is wrong with this way?
why do they need the Town object ?
do they need any logic that is contained the Town ?
because in a DeliveryRequest object send($customer, $courier, $items) method I check if the $customer and $courier are in the same location by doing if( !$customer->sameLocationAs($courier) )
I don't know if this is worth creating a question for, but can anybody help me with what '$var =& $this;' does at all? I'm digging through CodeIgniter's files & found that, Google's not too helpful lol
@emma.fn2 it assigns a reference of an object to a varaible
it is an artifact from PHP4, and in PHP5 is considered to be a really bad practice
14:15
and there are more times I need to use a Town objects data too. Do you understand what I am on about now?
Oh, so I shouldn't use =& in my code? I don't know what I'd need it for really
The Town object is a very important object in my application
I have a rather peculiar problem with an ASUS laptop (not mine), the screen, seemingly at random, goes black for a few seconds, sometimes as long as a minute, and then returns normally. No error message pops up, and nothing else seems to be affected (mouse, keyboard, etc). Win7 64 bit, Nvidia GeForce GT635M. Anyone knows what might be the issue?
(Wanted to see if anyone here is familiar with it before I go to Super User)
Seen that happen on a few laptops before it was just the video card driver crashing
@emma.fn2 watch this youtube.com/watch?v=_YZIBWQr_yk .. as for the short answer : you should never use references for objects.
14:17
Thanks ^^
.. sorry for multiple pings
@tereško are you saying to not use virtual proxies or what?
@emma.fn2 Congrats, you just found one of the many reasons why CodeIgniter is really, really, really terrible ;)
I always thought CodeIgniter was good/lightweight? xd
lol
@emma.fn2 among php frameworks codeigniter and cakephp are the two worst frameworks , closely followed by yii as third
14:26
Really? Everything I know is wrong lol, I was just looking for something to learn about MVC, and CI, Cake & FuelPHP were coming up in all of my searches
@tereško Which is better Zf2 or Symfony?
damn, someone or maybe more peaople are upvoting my answers and I reached 200 rep for today :O
@HamZaDzCyberDeV stop abusing your puppet accounts =oP
I'm not :(
@crypticツ symfony , because zf2's removal of global state was kinda flaky .. it's still using a lot of global'ish registries
14:28
I'm afraid I get banned for this ...
@crypticツ but as i have said before, this is like contest for the smartest kid of the remedial class.
Anonymous
just finished my self-imposed ban of 3 days
@phpNoOb wow, why ?
@HamZaDzCyberDeV you might be investigated, according to the rep history all the votes happened within a half-hour
DAAAAAAAAMN ><
14:31
@emma.fn2 you might find this somewhat useful .. and yes , i am advertising my own post there =/
@phpNoOb congrats
@tereško So what would be the best framework in your opinion?
Anonymous
i wanted to rest. i had study ... @HamZaDzCyberDeV
@phpNoOb I see ...
Anonymous
@Gordon make it for a week this time pls
14:32
@tereško Oh dear that's confusing lol, thanks though. I still barely know what MVC is :P
Anonymous
@igorw thanks :)
@crypticツ there is no such thing. When you are looking for a framework, you should be aiming at "what's best for this exact project". Also, there is always the part that if used badly, it will not matter how good the framework is ... people can drown in soup bowl
@crypticツ the only exception to what @tereško just said is jQuery. Always use jQuery.
More often then not, if you are making something alone, the best option is actually make your own, if you can. If you have a large team where multiple people are really good at using Lithium, the best option will be lithium, because it will lessen the overall development risks in project.
As for jquery. If you have developers that insist that you need to use jquery to make things done .. you might to need someone who actually knows javascript. Contrary to the common opinion, it is quite hard to write good code with jquery. And when combined with low quality of plugins and the natural performance limits, IMHO, it's more of a "for prototyping" framework
the problem isn't so much jQuery itself (although it is bloated) as it is "jQuery developers"
14:39
yeah =/
@tereško I wish Lithium was listed here so I can compare, but while looking at the table I have to ask what is this MVC push-pull thing?
@crypticツ lithium is actually quite bad framework. It's basically all static. But it has some nice ideas. The point of example was that even if framework is quite bad, with the right conditions it can be the "best option".
@crypticツ click the link for push/pull
@Gordon doh >.<
@crypticツ *hug* :)
@crypticツ tbh, even if Lithium was listed the list wouldn't tell you much. the only useful information there is whether the ORM is ActiveRecord based or not. If they are, you don't want them because ActiveRecord is not an ORM.
14:47
@Gordon Oh no, everything I do is wrong =o( I use CI with ActiveRecord
@crypticツ dont worry. What CI has is not ActiveRecord :)
whew, then I am accidentally lucky, but still unfortunate.
yeah , you have to add plugins to CI to have activerecord. One of those is called "Datamapper ORM" .. which should get the award for Worst Named Plugin
@tereško hilarious ;) At least they are consistent in misnaming things
@crypticツ my suggestion would be to use as much vanilla php as possible for the domain model of your application and use existing components for the stuff around it. for the components make sure to write adapters and use them through those instead of directly. That will make it easier to swap them out later
it actually is not too hard to force CI to use proper model layer
14:56
@Gordon you lost me at domain model =o( I really should read a book on this stuff.
@tereško what would need to be done?
@crypticツ Domain as in Problem Domain. The code relating to what your application is made to solve. Basically the stuff your application does. Whereas the components are just stuff every application needs, like DAOs, Caching, ACL, HTTP Clients
@crypticツ i would aim at using the CI's loader to produce Service factory , which then does the rest of the work
15:23
What would be a good character to use as text for an anchor link? I am doing this right now <a href='#anchor_name' id='anchor_name'>↵</a>
I might be able to use ⚓ but not sure if it will show up on all browsers =oP
@crypticツ the paragraph character maybe? (depending on the context)
@NikiC gist.github.com/cspray/1689430#cv-pls-documentation using it to mark sections so can be bookmarked or linked to.
@crypticツ the problem with such symbols is that you cannot control the font that user will be using, and if said font does not have that symbol .. well .. it's bad
the general recommendation from freenode's ##css channel is to use image instead , that way you can even add and ALT text for text-mode browsers
.. well that WAS the recommendation two years ago when i was frequently haunting IRC
@tereško I might just do that. That char is part of the HTML entities list from the W3C so even that would be influenced by a font?
15:35
"Info", "Data", & "Object" in class names are correctly pronounced "ummm"
it also means to avoid « and » (as characters) in pagination
@tereško darn using an image removed the underline hover
yeah ... that part sucks
@Gordon shame, that none of my current coworkers would even recognize it is a joke .. so actually understanding ,what it is joke about, would be simple beyond them
also , it's a joke with a good point =]
Interesting how the swastika gravatar preview in Google Images shows the cv-pls icon encrypted.google.com/…
@PeeHaa埽 I've unofficially officially made you a trend-setter =o)
@crypticツ ever heard about "Rorschach tests" .. you stumbled upon one =P
@crypticツ :-D
@PeeHaa埽 It really sucks that mysql isn't directly removed in PHP 5.5 :o (yes, I know that to first deprecate it is necessary, but it sucks.)
@tereško boobs? where?
15:50
mostly
@bwoebi Why does that suck?
i guess he has never had to maintain a log running project .. or introduce/remove features from said project
@bwoebi just disable the extension? I plan on removing the compile config option once software I use drops support for it.
@crypticツ Yes, I could remove it locally, but this wouldn't help against such questions...
a) I see every day multiple times on SO comments like don't use mysql, use mysqli or PDO instead
b) Such questions wouldn't have to be asked
@David back
15:56
@bwoebi And you think dropping support in 5.5 entirely would prevent questions like this?
The only thing that would happen is that people will stop upgrading. Get (more) annoyed by PHP. Have to rewrite stuff suddenly.
@PeeHaa埽 No, but there will less, I think.
@Ocramius I forget what we were talking about haha
They may stop upgrade for one or two years, but as of there are no security upgrades anymore, they have to upgrade
user1125394
Can PDO return typed data? eg a number if it's an integer or double, a string.., for me it returns only string
@David you are using proxies to workaround circular dependencies
15:58
Upgrading is not a problem when you are playing with PHP at home, but on a corporate environment people don't rewrite code when there is no money being thrown at
@Ocramius well not to work around them. I am using virtual proxies so I can lazy load some objects
@Ocramius he is using proxies to cause circular dependencies
@Ocramius and I have a MapperFactory and a Proxy factory and they both depend on each other
he's trying to work with domain objects as if they were active records
@David I see. And there you'd use a lazy factory or such to workaround it. Why do the two depend on each other though?
16:01
@tereško why do you always come in with these smart answers to try and make people look stupid and then give no alternative
because his "domain object" contain proxies, that represent some other "domain object" that can also contain proxies for more "domain objects". You cannot use domain object to crate activerecord-like object graphs
@David ignore. Can we please focus on the problem? :)
@tereško do you even have an idea of what he's doing? Because it looks like you don't.
@tereško you are crazy
miles and miles off what I am talking about
user1125394
PDO::ATTR_EMULATE_PREPARES => false does it if there's nothing specially wrong using it?
Herro
user1125394
16:05
(no weak security) ^
3 hours ago, by David
But what if I am just creating 10 Customer objects to see if that customer is active for example, I do not want to create a fully populated Town object which every customer has and then that will go and create a County object and that will go and create a Country object
@tereško why do you keep bringing up active record? where have I once mentioned anything about active record?
2 hours ago, by David
When I load a Customer or Courier object I either have to load their Town object in the mapper and setTown($town) or else replace that Town object with a TownProxy which implements a Town interface and it will only load the Town data if I need it
@tereško that's exactly what virtual proxies and ghost objects are for. So stop telling weird stuff about AR. We're not in that context, and you missed the point.
oh well .. then he's all yours
16:07
@tereško my proxies implement the same interface as my domain objects. for example my CustomerProxy implements my CustomerInterface but it holds the customers ID and the CustomerMapper
so I do not know where active record comes anywhere into this at all
@David the only concern I have there is why the two factories depend on each other. Proxying is a valid workaround, but circular dependencies smell anyway :\
@Ocramius yeah ok I will explain now
I will explain firstly my MapperFactory
my MapperFactory depends on the $dbh (PDO) and the ProxyFactory
because lets say I want to build the OrderMapper instead of passing it the CustomerMapper because every Order has a Customer
I then build the CustomerProxy with the ProxyFactory
does that make sense so far?
Yes, but why does the proxy factory know about the mapper?
you could build a proxy by just injecting a small closure that builds the wrapped "real" instance, and use a string to tell what the original class is
because lets say if I want the CustomerProxy the CustomerFactory will build CustomerProxy and inject the CustomerMapper into it
so as you can see both factories depend on each other
user1125394
16:17
never understood why people struggle so much with those design patterns
@David we had that before and moved away from it in doctrine
@David: current approach is: ProxyFactory::createProxy($className, Closure $initializer)
so the mapper factory can indeed create the closure
it's some more code in the mapper, but it gets you rid of the circular dependency
@Ocramius what do mean by the closure exactly?
@David I just abstracted this stuff in my own project. You can see an example at github.com/Ocramius/…
user1125394
give up patterns, make an app that seems logic
this is basically what you're doing, but you're making your proxies aware of mappers, which is kinda meh
16:20
I thought your proxies need to know of the mapper
as in your proxy will hold the ID of your domain object and its mapper
@David that's what the closure does. It's a callback
so it can then load the domain object by its ID when it needs to by using its mapper
@David $initializer = function (& $realInstance) use ($mapper, $id) { $realIntance = $mapper->createReal($id); }
@David this simplifies it a bit, no?
16:23
why is your mapper creating objects ?
It is not creating objects
why are you passing a reference to the function when it can just return an instance ?
what the hell is going on ?
I know about callback from jQuery but not so much in PHP
@tereško that's how my current implementation works for maximum flexibility. Yes, it could return the real instance
callbacks*
16:24
@tereško you can read the docs about that functionality I wrote :)
@Ocramius , why are you mapper creating instances of objects ?
i do not know what "functionality" you are talking about , but this is crap
@tereško I just made an example. It could also be $initializer = function (& $realInstance) use ($mapper, $id) { $realIntance = new Foo(); $realinstance->setBar('bar'); }
@tereško can you give an alternative to virtual proxies
you do not need proxies
stop creating complicated object graph when they are not needed
16:27
@tereško what?
for an instance to interact with other instances, one does not need to contain another
why would you want to do 20 database queries when you can just do 5
can do just 5*
@tereško what you're suggesting is moving away from an object graph and passing one object to another to hop around what was the graph before...
why would domain objects have any impact on how many queries you make
because the data for the domain objects is stored in the database
16:29
why is it that the customer instance need to contain a town instance that can contain other customer instances ?!?!
@tereško because the town has customers? O_o wth @tereško, you serious?
a town instance does not contain a customer instance
that would make no sense
@David yes, but you could have bidirectional associations
I'm not getting what kind of stuff @tereško builds to access associations in a DB
@Ocramius town has customer IDs
@tereško no, town has customers :)
16:30
why would a town have customer ID?
an ID is just an artifact we use to work with DBs
a customer has a town_id
when you assign a town to a customer , it does not become a part of customer
I have a setTown(TownInterface $town) in my customer domain object
@tereško no, it's not an embeddable...
@David btw, try giving that approach a spin if it doesn't imply rewriting all ze things
16:32
Yeah I will
but I still need to find out what @tereško is on about saying you don't need proxies
I know you don't need them but if they will save you database from making 20+ queries to making 5 or less I do not see why you would not use them
m59
m59
In Joomla (and other CMS) your database username/password are stored in a file as part of a class. I've heard of hackers being able to use file_get_contents to read php files... Under what conditions could someone do that to get access to that database info? How do you ensure the security of it?
@tereško ?
plus they only take up memory when you actually need them
what you essential are is $user->town->setSomething($different_object)
that is you mindset and it is wrong
@David if I get this correctly, what you are doing is $customer->getTown()->getName();. What he's doing is $townMapper->getTown($customer->getTownId())->getName();
@tereško it's not, you're just trying to force your idea as "correct" here
no no no
what I do is create my Customer with my entity factory
set it's ID
16:35
hes trying to implement an activerecord by using proxies that contain both parts for domain and storage logic
do $customerMapper->fetch($customer)
@Ocramius who is "he" ?
@tereško and that's perfectly fine for proxies O_o
@tereško "he" is "teresko"
why would i break LoD ?
@David yep. Does $customer contain a reference to a town then?
@tereško that doesn't imply you're breaking the LoD. You just have a data structure that works regardless of the storage layer
16:39
and then instead of my CustomerMapper holding a TownMapper and using the town_id to fetch a new Town I just inject the TownProxy into the Customer because the TownProxy implements the same interface my Town domain object does and then only if I need to get the town the proxy will load it and I can use the proxy as if there was always a real Town object in the Customer object
@Ocramius this: $townMapper->getTown($customer->getTownId())->getName(); implies both breaking LoD and SRP
@David and TownProxy calls $townMapper->fetch($this) when lazy loaded
that's it .. bye
Good
@tereško yes, but that's how you're working if I get it correctly, no? What are you currently doing instead of that? I wrote a one-liner with it :)
16:41
@tereško always disappears after trying to make other people look stupid and not even understanding their question
so annoying
ever since I signed up here
and no alternative
@David just ignore him. From what he wrote until now I now have a clear idea that he probably never used this stuff (your approach), so this looks like black magic to him.
@tereško why have you not answered my question about why would you choose to do 20+ queries over using proxies and doing just 5 or less
this is the way I have seen proxies implemented most of the time
if I have a CustomerProxy it holds a Customer with its ID set, and it holds the CustomerMapper
and then when I do something like $customer->getTown()->getName()
that was wrong I ment
@David there's only one problem with that right now, which is that any method of $customer or $town that passes $this internally to other objects is possibly broken
none of them pass $this
ok so this is how it works with my Customer object
@David yes, I'm just saying that could break. Don't worry too much about it
16:50
ok, either im too dumb to use puppet or puppet sucks
@Gordon there's always chef :trololo:
@Ocramius yeah, I know
seriously though, trying to get rid of chef
SH would be better
I have a Customer object which is populated with data from the database. It has a setTown(TownInterface $town). In my CustomerMapper when assigning the Town to the Customer, instead of using a TownMapper to fetch the Town I just set a TownProxy which implements my TownInterface. My TownProxy holds the townId and the TownMapper
@David and that's perfectly fine =)
16:52
and then when I have my Customer object and I go like $customer->getTown()->isActive() the TownProxy will load the Town object for that given townID and let me use the proxy as if it were a real Town object since it implements the same interface
so is all that 100% fine?
@David it is all fine. Just the two factories should not depend on each other =)
@Ocramius SH?
@Gordon yep. Why writing ruby when SH works too for those tasks?
@Ocramius you mean Shellscript? or some other fancy tool?
shell script, yep
16:56
@Ocramius gonna have a proper look at your link now
@Ocramius i am considering giving chef a try. my attempts at creating a lamp stack with puppet have all failed
and I find the puppet docs extremely unexplaining
a lot of blahblah that doesnt get to the point
@Gordon it's an obnoxious syntax. chef looks easier at the beginning
@Gordon but are you trying to write from 0 or using existing recipes?
@David ideally, at some point in time, I may implement ghost objects in that library. That would also fix the problem of passing $this around =D
@Ocramius i am trying to get apache working with the official puppetlabs module
I managed to get the apache up and mod_rewrite installed
but when I am trying to add a vhost it complains that it "Could not look up qualified variable"
:\
can't really help on that now, since I really need a refresh on puppet too :(
i've checked other recipes. most of them create the files apache uses as templates or hardcoded configs and then simply use puppet to put them at the right locations via the file type/resource
17:04
yep
and you wanted to use a template or such?
no. I tried to follow the approach given in the puppet docs
which would be
apache::vhost {'mysite':
    port => '80',
    docroot => '/var/www/example.com/app/webroot',
    options => 'Options FollowSymLinks',
    override => 'all',
    ensure => 'present'
}
so I am supposed to use that apache::vhost thing
but yeah, doesnt work
and when I include apache before calling that, it complains about something else
anyone played with hhvm?
@igorw hiphop? no.
when i tried got a lot of errolls and left it be for the moment
17:22
To remove a submodule you need to:
Delete the relevant line from the .gitmodules file.
Delete the relevant section from .git/config.
Run git rm --cached path_to_submodule (no trailing slash).
Commit the superproject.
Delete the now untracked submodule files.
i honestly don't get why all the devs around me praise tools that require you to go through hoops to achieve something.
I think the git submodule stuff is being rewritten because of that mess :\
@Gordon yeah, hhvm is the new-ish JIT version of hiphop.
@igorw is it useful if you are not fb?
@Gordon for most cases probably not. for networking, the extra speed could make a difference, same goes for data processing.
@igorw then I leave it for the alpha nerds to play with it
17:29
can someone help matching this string with a regex? trying to detect if 'token' exists, and if so, capture the page number. /path/to/token/page/2 or my/path/token/page/3
Uby
Uby
@DaveKiss What's your current regex?
@DaveKiss $pageNumber = strpos($string, 'token') !== false ? substr(strrchr($string, '/'), 1) : 1;
I don't really know what I'm doing, but I was trying (.+?)/token/page/(\\d+)
and, I have to use preg_match in this situation
Uby
Uby
@DaveKiss You need a delimiter, what are you using as a delimiter?
@DaveKiss why?
17:39
%(.+?)/token/page/(\\d+)%
using a wordpress function to add a rewrite rule, which only accepts regex
Uby
Uby
@DaveKiss that should work
The pattern is within a single quotes string or double quotes string?
single
Uby
Uby
@DaveKiss then you don't need \\
just \
@DaveKiss preg_match('#.+token/page/(\d+)#', $string, $matches);
ah, ok
thanks. do you guys have any good resources for learning these patterns?
Uby
Uby
17:44
your pattern is fine
maybe you should learn difference between single quotes and double quotes
I understand the difference, just overlooked it
thanks Gordon
18:08
If CodeIgniter is a bad framework, which would I be better off with to learn about MVC?
@emma.fn2 there is not much to learn about MVC really
C: handles input, V: handles output, M: everything else
C+V are a User Interface to M
M should work independent from a User Interface
and that's all there is to it
afk now. dinner and tv
@Gordon oh right lol, I thought there was way more to it. I just understand that the front controller usually takes the URL, uses that to find out what controller/method to load, calls that which gets your data, and then the front controller puts the data into your view
18:36
@emma.fn2 The front controller doesn't put anything in the view
@PeeHaa埽 Oh? I'm confused now then lol
user1125394
need to implement inactive record in my controller's model view
@emma.fn2 Basically the only thing a front controller should do is get all requests and delegate it to the controller/method of the current request
V->C->M(->V)
@PeeHaa埽 so then the requested controller will deal with the data & view?
18:45
@emma.fn2 The view will take care of getting the data by asking it from the model layer
@PeeHaa埽 I thought the view is just essentially HTML (or php includes to build HTML) with variables in like $data['titleTag'] etc? Sorry for the silly questions lol it's confusing me >.<
@emma.fn2 That is a template
@PeeHaa埽 Thanks; I think Teresko linked me that one earlier
@emma.fn2 were you the guy with auditory problems ?
or was that a different one asking around this week about oop/mvc ?
@tereško hmm I asked earlier about mvc and codeignitor and you spoke about it earlier today
18:51
then it wasn't you
you could start by watching the "clean code talks" lectures on youtube
that should give you the basic , before you actually dive into studying mvc
mvc is a design/architecture pattern for oop , therefore you need to be comfortable with oop principle and practices to actually understand it
I do understand OOP & classes well I think, I just don't know how MVC is designed; my idea of it is different to how it actually is, it seems lol. I'll give that a watch though, thanks
in that case watch only this one: youtube.com/watch?v=4F72VULWFvc
if you do not learn anything new , then you can ignore the rest
otherwise you might not be as good in OOP as you think you are
Thanks :)

« first day (918 days earlier)      last day (4255 days later) »