logs archiveIRC Archive / Freenode / #php / 2015 / July / 16 / 1
Gatomon
blanketmind, it's not about open source fanatic...
It's just that technically, cryptic code can be learned.
gmcinnes
PsychoBoB: yuk yuk == ha ha. I thought you were joking.
Gatomon
blanketmind, anyway. I was curious to see what you were up to.
blanketmind
Technically, any lock can be open. NEVER LOCK YOUR DOOR?!?!?!?!?!?!!?!
*opened
Gatomon
blanketmind, there are many existing tools for this purpose anyway.
You there trying to write your own. Majority of the helpers in ##php aren't going to help you with something that's really a waste of their time.
Being cryptic in what you need in ##php is not how ##php really works.
Sammitch
Gatomon: unless you're a masochist for sarcasm, that is. :D
bango2
yeah, thats right, hit me harder in the face with your veiny sarcasm
blanketmind
Gatomon: You're talking out of your ass.
Not a single such tool exists and I know this for a fact.
Now I'm gonna go for a walk or else I'm gonna go nuts stuck with these bugs.
tekhneek
Can someone help me put a name/link to this idea... I'm trying to wrap my head around objects that can "morph" into others or based on attributes know they need to change state. If I have lets' say an object Product and when given certain attributes it returns other attributes that are valid for the current assigned attributes. It's similar to bein
g able to get all the available options for a given option, I'm not trying to do this with a database though I'm trying to do this with plain objects.
like Option->getOptions, Option->canHaveOption($option) ?
I'm trying to design this simple too and not make it messy
I don't want to reinvent the wheel though.
         

Sammitch
< blanketmind> Not a single such tool exists and I know this for a fact.
looool
plenty exist, except the people that write them are paranoid whackos who never make them public
eg: blanketmind
Gatomon
tekhneek, I think you are describing monads.
Or not. o_O
Hell, there is even a free code obfuscator... BUt c'mon
tekhneek
Gatomon: I'm pseudo-coding out something that's giving me Attribute, AttributeRule, a "Ruleable" interface and I'm working on the comparison
Let's say we have Attribute X and Attribute Y... Does attribute X need to know everything it can support, and does Y need to know the same, so each attribute keeps track of what it can support? What if they overlap? That doesn't seem very clean or DRY
If they both support Z does Z need to say it supports both X and Y? I guess maybe that's the answer
Sammitch
maybe if you could give a more concrete example we could make sense of what you're trying to get across
tekhneek
Sammitch: I'm trying to code one up, one second
lucyfx
quick question: Class A { public AnotherClass $b; } <- is something like this(or this) possible?
DissidentRage
no, use namespaces for that
lucyfx
like what?
how would a namespace let me use a class variable
DissidentRage
oh, misread
yeah you can use a class instance as a property value
biberu
(but you can't typehint properties, use accessors to control how they are used)
DissidentRage
but to enforce strong typing you'll have to use __get and __set
and use the instanceof operator
or use getB/setB
biberu
any accessor, you don't have to use magic methods, and normally you should probably avoid that and opt for a well defined interface instead
DissidentRage
^
lucyfx
I was thinking something like, having a "Player" class and "Money" class with default values, so I could do something like: $player = new Player; $player->money->add(100);
whats the best substitute for this?
just keep as a $money and init it in construct?
tekhneek
Sammitch: http://pastie.org/private/d9repetyxaeste45ez9agg
lucyfx
for example at no point I will be passing Player a Money class
tekhneek
This isn't done, nor probably finished with overall structure being refactored...I'm trying to wrap my head around it right now.
lucyfx:what's wrong with player/bank ?
lucyfx
while the script is running, there will be more than 1 player, so there cant be a single bank class, and a player has a lot more things than a bank so I cant keep "players" and "banks", bank(money) should go inside player
tekhneek
a Bank can have deposit(), withdraw(), balance() methods on it easily, each player could have a bank object
Are you structuring this management of players in a "game" object?
lucyfx
during runtime players will be added and removed, when adding it will be read from db and while removing it will be written, I'd have to keep track of tons of classes. the plan is to have a ->collectData inside player
think of it as an always running script file
         

tekhneek
lucyfx: You're building a game
lucyfx
close
DissidentRage
why not just store money numerically?
ash_m
if someone's goal is to construct a "centralized place to send outgoing mail (SMTP). Assume it will send via Amazon SES API so the actual SMTP transmission mechanism isnt in question." would you interpret that the system is already using SES but they're using a factory method and want to use a service locator of sorts to tie their calls together or something?
lucyfx
a money class will do more things than keeping an integer and money is just an example
biberu
lucyfx: there are several ways, but if it needs to be a complex type you may want to look up the law of demeter (https://en.wikipedia.org/wiki/Law_of_Demeter) before deciding anything
DissidentRage
k
ash_m
that as*
lucyfx
I'm not going againist demeter tho am I? the plan is to have a player knowing only about his own money
tekhneek
so give him a protected $cash attribute, or $money attribute
and make him implement an interface that lets you add, remove and check the balance of his $money
DissidentRage
or $cashmoney
tekhneek
$dolladollabillzyall
DissidentRage
#winning
lucyfx
yeah, that seems like the best/only solution currently
<tekhneek> and make him implement an interface that lets you add, remove and check the balance of his $money
not this part tho
imagine a player having 10 classes
will the player implement addMoney, addQuest, etc...
DissidentRage
how would he have time for anything else?
lucyfx
it will go pretty big pretty quick
tekhneek
He could write a really sweet while loop that just adds $10 to his account every millisecond and get rich
ash_m
lucyfx: the bank should be responsible for such methods
DissidentRage
tekhneek: hue
just make sure you don't put one too many zeros
tekhneek
lucyfx: Just make sure each class has its own specific job and you're not doing what a standalone class could do within player, don't hate the player, extend the game? what?
Gatomon
tekhneek, where did you get this "idea" from?
tekhneek
I want to basically have a fixed list of attributes, that can change... like product attributes. I want to be able to "get" the available attributes for a base set of attributes.
lucyfx
like eav?
tekhneek
Gatomon:I basically want to see what attributes I can have for a given base set of attributes
if we're talking about something awesome like ice cream, maybe there's chocolate and vanilla flavors, but only vanilla gets sprinkles and chocolate gets a waffle cone
well what if I want to see what I can get with a waffle cone instead of just a flavor, etc
I want to get a "map" or a "list" of available attributes from any other independent attributes
I guess it belongs in a database. I'm just trying to do it with code because I don't want the database overhead.
lucyfx
tekhneek: isnt that eav basically?
tekhneek
lucyfx: I mean yeah, but that's a database pattern that a lot of people don't really like. It has a lot of drawbacks.
I'm talking about doing this in pure code.
lucyfx
public function addAttribute($attributeName, $value) { $this->{$attributeName} = $value; } just noticed this works, probably a bad thing to do :D
tekhneek
It'd be an Attribute object anyway, I wouldn't add strings and values to a class like that
mentoc
We have a flash object that is performing a file upload to a php script. Everytime a large file is uploaded, a 404 is thrown by the upload handling script. I can place a log statement at the very top of the handling script and that log statement will not execute if uploads are big. It will execute if uploads are not big. I've set upload_max_size to a very high amount as well as max_post_size
xyphoid_
you've set those in php.ini and restarted to ensure they're set?
mentoc
I used ini_set
xyphoid_
you can't sensibly set max_post_size using ini_set - it's too late
post unpacking happens before your code starts running
mentoc
xyphoid_: omg that's probably it
« prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 next »