« first day (405 days earlier)      last day (4543 days later) » 
00:00 - 14:0014:00 - 00:00

2:00 PM
@hakre Basically I want to implement some form of error handling if for some reason my autoloader fails to find the file my application needs to continue, figured the easiest and/or only way to do that was to throw an exception in that condition, but the exception is not being thrown if the autoloader is called from a static method call rather than a normal method call.
@edorian So you're saying that if I want some kind of autoloader error handling I shouldn't resort to Exceptions, any ideas on what other kind of error handling I could implement instead?
 
Ah i see. The static call fatals before the exception is thrown
 
Yarr
 
I'm saying you maybe don't want error handling in your autoloader because there will be multiple ones in your application and you can't have on error out.
What I've seen is people just not doing anything when a class it not found and letting PHP just die and show a 500 page in those cases. If a source file is not where you expect it thats usually a major issues with the application anyways
If you want to say "see if that 'plugin' class exists" I'd go for class_exists("MyPlugin"); and let that trigger the autoloading
 
@Willempie Just check with class_exists before you make use of a class. It can trigger autoloading and if autloading fails, it will return FALSE.
same like edorian wrote.
 
high fives hakre
 
2:07 PM
@hakre That would mean I'd have to check the existence of every class before trying to use it, seems rather messy.
Guess I could try something like register_shutdown_function(function() {
if (error_get_last() !== null) {
/* gogo Internal Server Error */
}
});
 
Well if your code should run whether or not functions it calls are available, I think this can only get messy w/o checking function existance.
 
If a non optional class is missing from your system it might as well be the error handler
 
@edorian hi ;)
 
you need to take care of those errors on another level (like having a 500 page that gets shown when a script fatals)
 
@Willempie The eval class you create could have a the magic function __callStatic to catch non-existant functions (and make that throw an exception then). But I really question if that is actually what you should do.
It might work though.
 
2:10 PM
Well, the eval only get's called if the class doesn't exist, as such the method of that inexistent class won't exist either, so the current eval() implementation does work, I just don't like having eval() at all :P
It's actually the first time ever I resorted to using eval();
 
@Willempie If you dislike eval, use include instead :D
and verify the classname first.
Not that someones injects code into your autoloader.
 
@hakre Yeah but that was kind of the issue, the whole reason I wanted this kind of functionality was to handle situations where my file structure for whatever reason was compromised, using include in that situation would require a intact file structure, which, if the autoloader fails, isn't guaranteed :D
 
include('data:// your base64 encoded eval code');
actually that's exactly like eval you could say
and so it is.
You should better take care that your files are in order and classes exists or are available for autoloading.
Otherwise your application design is broken anyway.
I would not resolve such flaws with the autoloader.
 
@hakre In terms of verifying a classname, how would you implement that, wouldn't that require some form of array with valid classnames, or were you thinking of some very minimal value checking to make sure it can't mess with the system
 
Too much magic.
@Willempie First of all it should be a valid classname. A whitelist is not bad either.
 
2:17 PM
A valid classname meaning: no whitespace, only [a-z][A-Z] ( not exactly sure what range of characters are considered valid there ) Should do some googling.
 
The link above contains some regexes and links to the PHP manual where it is documented.
 
That regex doesn't take into account the php reserved words, right? So I should check the regex, then check reserved words ( or vice-versa ).
( nice post btw, not sure if Google would've presented me that page ) :D
 
@Willempie I think it's okay to check for a valid classname only (w/o reserved words) to prevent code injection into the eval statement.
Probably some error handling if eval fails as well.
But if your eval fails, you're lost.
So better change your design that you don't run into the problem at all.
 
@hakre In what conditions could the eval fail if the classname is validated? And yeah, I'll start thinking of a new way to do it :D
 
hi
 
2:27 PM
ho
 
Good evening. Had to go to work. :)
What's up?
@NikiC Hi!
Guys wanted to ask you, how is authentication made in now days. Specially in shops. And not counting some cards. Just plain forms.
 
@Eugene Not exactly sure what you're asking here..
 
2:43 PM
Hi @NikiC
 
2:59 PM
@Willempie For example. Visitor converted himself to customer by regsitritation and for some period of time he was missing and when he comes back earlier I got needed information from cookies, but later I got info., that such information can't be there so therefore I don't know how it would be better to check if such customer exists and if so, then log him in automatically.
 
3:16 PM
@NikiC Wanted to ask you about Twig again. If I have wrtitten a function and usually it is used with one certain parameter, but sometimes I would like to pass an array defined in template to this function as second parameter. How could I do that?
 
You mean a function or a macro?
 
function
@NikiC For example. One time i do {{ include_block( 'block_name' ) }} and other time I call {{ include_block( 'block_name', array/or template variable, that is an array ) }}
 
and where is the problem?
If include_block has an optional second arg that should work right away
 
Okey then how should I get this optional second arg in my written method?
 
function foo($bar, $baz = defaultValue) { ... }
 
3:32 PM
@NikiC Okey. One more thing. How could I pass a array as a second param defined inside template?
 
@NikiC github.com/nikic/nikic.github.com/blob/master/_posts/… nice read: though those code samples aren't formatted at all, at least for me
 
@NikiC {{ include_block( 'block_name', [ 'oneVar' => templateVar ] ) }}?
 
@Eugene If you mean array then ['A', 'B', 'C'] if you mean a key => value map then {'A': 'B', 'C': 'D'}
@Willempie What @Robik just said
 
@NikiC But key => value map will be still recognized as array in self written function, right?
 
3:37 PM
@Eugene yes, in PHP arrays and dictionaries/hashes are the same ;)
 
@NikiC :)
@NikiC Odd. Tryed it like that {{ include_block( 'admin/adminLogBlock', { 'log_filter' : order_info_log } ) }}. Where order_info_log is a template variable
Didn't work
 
just ran a pilgarism check on prof's lecture notes and found 35% match a lot of paragraphs from wikipedia, would you report this?
 
@Eugene What happend?
 
@NikiC An exception has been thrown during the rendering of a template ("array_key_exists(): The first argument should be either a string or an integer") in
 
do you use array_key_exists in the function?
 
user50049
3:47 PM
Anyone familiar with Codeigniter?
 
@NikiC No.
 
user50049
I'm at one of those "i'm not sure what to even search for" moments
 
@Tim Nope, sorry
@Eugene Strange. And the error comes from the line with the function call, yes?
 
@NikiC Correct.
 
That's odd. Could you maybe post the compiled template (or the relevant parts of it)?
 
3:53 PM
@NikiC Second param was without quotes
 
@Eugene hm?
 
@NikiC Look closely {{ include_block( 'admin/adminLogBlock', { 'log_filter' : order_info_log } ) }}
 
@Eugene can't see anything strange ^^
How bad is it if a file declaring a class calls a static initionalization method of that class on include?
 
@NikiC Why would you want to do that
 
@NikiC 'log_filter' : order_info_log
@NikiC When it should be 'log_filter' : 'order_info_log'
 
4:06 PM
@NikiC Like registering an error handler or something like that?
 
@NikiC That was my ugly mistake
 
Not that bad if you don't have a proper bootstrap and need to make it work
But in most cases I'd rather have it lazy initialize on first use
 
@Eugene ah, I thought that order_info_log was a variable, sorry ^^
I stayed with the lazy initialization now
What I really wonder is why the heck they made token_get_all return strings for single char tokens and arrays for others. That is just such a pain in the ass to work with and I don't really see much reason to do it.
For example getting the line number of a token is slow + error prone because of that. If they just made all tokens arrays that problem wouldn't exist :(
 
@NikiC It is a variable, but it is map it should be marked as a string. When block is loaded it just takes it out from a template array of variables
@NikiC It just isn't used as one in template where this function is called
 
@Eugene aaah, now I get it ^^
 
4:13 PM
@NikiC Right. I didn't get it myself for a few minutes.
 
@NikiC Fully agree on the token point
Can i tell get that certain files should be ignored when merging branches? Case in point PHPUnit has a 3.6 changelog and a "master" changelog. 3.6 only has 3.6 changes master has 3.7 and beyond. When i `git merge 3.6` into master i always get a conflict in the changelog (when that was changed).
It's ok that that happens and i see why but it's annoying to deal with and given it's git there is always a way to "do things right" isn't there?
 
4:31 PM
@edorian No idea, but I imagine it's something like creating a .gitattribute with a merge=ours on the file
 
Does anyone want to review/check out this thingie: github.com/robik/Graphix/tree/dev ? I want to know if you suggest any major/minor changes in API or something so I can continue working on it :)
 
13
Q: How do I tell git to always select my local version for conflicted merges on a specific file?

saffsdSay I'm collaborating with someone via a git repository, and there is a particular file that I never want to accept any external changes to. Is there any way for me to set up my local repo to not complain about a conflicted merge every time I git pull? I'd like to always select my local version ...

The answer read like "you just don't want to do this now"
 
looks pretty complicated
I though that the ours driver is defined by git, but looks like one needs to register it oneself
 
@Robik public function unload()
{
imagedestroy($this->img);

return $this;
} Shouldn't you first check whether r not $this->img is still an image ?
 
nsfw but thats kinda how the works this works feels: Link
 
4:42 PM
@Willempie It just returns true/false, if image exists destoy it, if not, who cares? :P
 
*the way this works
 
@Robik I figured it would generate a warning if there wasn't a image to delete
Which can happen if you call unload manually and then later on the destructor is called
 
@Willempie But thanks, it shoots warning if its not image. Fixing it
Forgot to check it, and manual does not meniton about warning
 
There are some other methods in that class that could benefit from some validation
Such as public function getSize()
{
return new Area(imagesx($this->img), imagesy($this->img));
}, imagesx() and imagesy() can return false instead of null if $this->img isn't an image
The Area constructor only handles null / array
 
No, it handles 2 params also
 
4:49 PM
@Robik I guess, depends on how much hand-holding you want to do I suppose
 
But I can't check all the time if user have loaded image..
 
@Robik yes it handles 2 params, but not it doesn't handle false, which imagesx and imagesy might return : P
And I suppose you could just implement some kind of isThereAnImageToWorkWith() method ( with a better name )
 
All because user forgot to load image :P
 
I see that you're not into the hand-holding, that's fine too, I suppose :D
 
Done
 
4:53 PM
I usually do the hand-holding at least for the purposes of returning some useful "you can't do that yet' message :D
 
This makes my project not for newbies :P
 
nobody ever wants to hold my hand... :(
 
I don't want do something like: Okay, now try to resize image. Oh noes! You forgot to load image, dont worry, I'll do that for you!
 
@rlemon * inserts random remark about computer geek stereotype *
 
/// some logic
echo "<em> Okay, now try to resize image. Oh noes! You forgot to load image, dont worry, I'll do that for you! </em>";
// some more logic
 
4:56 PM
@Robik I wasn't implying you should try to fix their mistakes. I was -trying to - imply that specific error messages could guide the guy behind the PC to the solution faster.
 
@Robik problem solved
 
@Willempie Call stack does.
 
see the first /// some logic does BLEEP and the second does BLUURB, make sense now?
 
@rlemon :)
 
sorry... really i'm just trolling waiting for NetBSD to download.
 
4:59 PM
@Robik well, in some cases you do return error messages if the programmer is being silly, was merely trying to steer you towards applying that on a broader basis.
Or not at all, whichever is your poison.
 
5:11 PM
Huh? :P
 
the document i'm working from was last updated November 25th 1995 - ohh god!
 
@rlemon xkcd.com/979
Somewhat applicable
 
yea not really - docs and specs for our core system.
 
Sounds like fun
@Robik You sometimes throw an *Exception when user input is bad, was referring to that
 
Yeh
 
5:44 PM
anyone got the time to tell me which version of php mailer to use and which tutorial to follow?
:D
 
@StephenWolfe answer to both is probably the latest stable
 
morning :)
 
Evening here!
 
Good Evening @KamilTomÅ¡ík
 
@Gordon is it possible to parse python indentation blocks using just BNF? or is it necessary to use parser-combinatory?
@Robik evening :)
 
6:02 PM
@KamilTomšík no clue but hi
 
@Gordon hi :)
@Gordon I'm not sure, if it's context free - should be, I guess :)
 
OT but interesting: gemeinwohl-oekonomie.org/en
 
@Gordon So feeling great will be a criteria for entrepreneurial success? No idea how that would work
Nevermind, misread that paragraph.
 
@Willempie Im sceptical about all those new society models, but I the ideas of this one aint too bad.
it sounds a lot like Open Source. And it takes up some ideas from Complexity Theory.
incidentally there is a talk about this in my town on sunday. I might go and listen.
 
@Gordon Well, from what I read on that page is that making more money than others will be ethically frowned upon and that universal welfare of people will be the pillar of society. But the function of financing doesn't change in that model, so making money is still a goal for everyone, thus nothing really changes
 
6:18 PM
@Willempie financing has a much less central role in that model if i understood it correctly. they want to cap having/earning money at a certain amount and give that back to society.
 
It is very interesting, but the question is how do you judge what is "enough" money in a free market society?
 
Putting a cap on success ( as that is linked in most cases to financial success ) seems very unintuitive. Wouldn't that hold back progress / innovation as it seems very unrealistic that every person would follow that mindset. A person at or above the cap would simply say "If I don't personally gain from improving, why would I'
 
@CharlesSprayberry its what society agrees on I assume
 
Some would argue that enough money is whatever your employer is willing to give you
 
@Willempie I didnt understand it this way. success doesnt equal income. Compare with Maslows Hierarchy of Needs. Success is a highly individual thing. In their model the well being of society equals success
 
6:27 PM
@Gordon But success for most people is somewhat correlated to their financial situation and I doubt that mindset would drastically change for everyone.
 
But, you'd rather be wealthy than poor. Success might not get you income, but everybody wants more money.
I mean, I actually agree with you and like the concept
I just don't think it could realistically be implemented.
 
@CharlesSprayberry Yeah, I think it would always remain "I, then the group" rather than "The group, then I"
 
Basic human behavior is to do in my best interest. Altering that instinctual behavior would take eons.
 
Can you even change ones instinct, isn't that like ... hardcoded like most mysql connection info in bad php applications? :D
 
@Willempie i dont agree to that. Money is mainly a motivator for achieving safety. Check secure.wikimedia.org/wikipedia/en/wiki/… and in a society where the first two steps of that pyramid are covered anyway, money becomes less important.
 
6:30 PM
well, i mean evolution can change and you can adapt. take dogs for example, at one point they were wild wolves and over the course of thousands of years they came to depend on humans. that's certainly a change in instinct from "prey hunter" to "scavenger", no reason to think humans couldn't adapt as well
 
Oh well, time to stuff myself with food, Maslow's needs and all that
 
but i already found a number of things that sound fishy to me in their pdf describing how to calculate that balance score. like we should mainly be vegetarians and vegans or requiring 50% of leadership positions being women.
 
yea, see they lose a lot of support when they start sneaking in political things. make it about the one issue, i mean that's big enough
and the chances of me becoming a vegetarian is null
maybe when i start seeing bacon growing on plants
 
@CharlesSprayberry can i overhear that on twitter? :D
 
i don't care
 
6:44 PM
How do you call Ökos und Linke in English?
I didn't read all of the text but it sounds like the typical socialistic crap
 
@NikiC you think so? i felt it is quite different. it certainly has a lot of left ideas but its far from communism or what Die Linke wants in germany.
 
I am very liberalist, so I see every model that tries to put "common good" as a goal as flawed.
The goal should always be personal wealth. As soon as you try to work towards the common good, everything fails.
 
@NikiC you are entitled your opinion :)
 
I think most of those ideas come from people who weren't properly economically educated (quote "author and political activist", not "PhD in economy"). People just see that other people have that and that many billions and the EZB again spent that and that many billions and oh I only earn three thousand per month and I want to earn a billion too and oh is everything is so unfair ...
 
@NikiC That remark made me think about Occupy * pukes * and hey, I'm back
 
7:01 PM
Yes, exactly, "We are the 99%" evolved from the same wrong ideas.
 
@NikiC ökos und linke - environmentalists and left -- According to Google translate
 
@NikiC that might be true for some but I doubt its true for all. At least, I know a number of well earning people who just agree our society is indeed too unbalanced nowadays.
 
The main problem is in my eyes that people think that unequal = unfair ;)
 
@NikiC what constitutes equality for you?
 
7:08 PM
@KamilTomÅ¡ík might understand what I mean. It was mentioned a few times in Hackers & Painters.
@Gordon If I earn one hundred times more than somebody else, then we are earning unequally, but still it may be fair.
 
but thats not what its about
 
I think this is what it is basically about ;)
What do you think it is about?
 
about creating equal chances
about not making other people suffer for your own luxury
 
Unfair in this context to me means that high quality/amount work often leads to low rewards while the opposite also exists
 
@NikiC have you liked the book? :-)
 
7:14 PM
@KamilTomšík I did ;) It matched pretty perfectly with my economic views + worldviews in general.
The only thing that somehow didn't fit into the book was the chapter on spam filtering ^^
Everything else was related, but the spam filtering somehow was just there
 
@NikiC huh? I don't remember that one :)
 
@KamilTomšík Bayesian spam filtering ;)
 
still nothing :-D
 
@NikiC out of curiosity, how do you base a job's worth? which job is worth 100 times more than the other?
 
seriously, I don't remember, either it was too boring to remember or I've somehow missed it
 
7:17 PM
@KamilTomšík basically this: paulgraham.com/spam.html (though less detailed in the book)
 
hm :-D not interesting :-P
 
@KamilTomšík yeah, it's the standard method nowadays I think. Probably back then it was something new.
 
all I can say is - hey, that is probably smart he can come up with his own solution but... what the **** does have in common with the rest of book :)
 
@KamilTomšík this is what I thought too ;)
 
7:25 PM
@Gordon That book I mentioned above (it's not really about economy, but it says something about it) does a pretty good job in explaining that I think. It says that with a normal job in a large corporation it isn't possible to see how much worth a person really is and that's why everyone earns equally (low). How much the CEO is worth on the other hand is pretty easy to judge (by the companies revenue).
 
@Nikic Is that a reliable way to determine the worth of a CEO?
Mind you, I have no idea on how involved CEO's are with their companies
 
@Gordon So, yeah, I would agree that you in particular are treated unfairly: you should earn much more than you do ;) [though I have absolutely no idea how much you earn, but I assume that it's less than what you're worth]
anyways, got to go now, laters
 
8:27 PM
Anyone else as fussy as me when it comes to programming.
 
8:38 PM
Yo
 
Ho
 
Waiting in line to pick up a new TV I ordered yesterday...
 
Hah, real men get stuff delivered!
 
9:26 PM
Anyone know how to install the PDO drivers for postgresql?
I can't find the name of the package or anything, it's a trail of deprecated packages and libraries.
 
@Willempie I mean how should I install these on ubuntu?
PECL doesn't do it.
apt-get isn't doing it.
 
What PHP version are you on
 
Dhurr, apache didn't restart correctly, this is my issue.
5.3
 
Shouldn't it then be installed by default, as PDO is part of the PHP core ?
 
9:34 PM
PDO for postgresql.
 
Let me understand here, you have the driver package already downloaded?
 
@Willempie The problem's resolved.
Pdo for postgresql doesn't install when you just install the php package.
 
@NikiC hmm, to me it sounds like that very CEO's lame excuse for getting paid 100 times more than the employees. And tbh I dont think a CEOs worth can or should be measured in revenue alone.
 
9:58 PM
really, it's like the CEO saying: of course we do value our employees. we just dont know them well enough to pay them what they should be payed. but we think they are all great unique snowflakes. i feel bad for earning more than them. really.
 
@Gordon as long as you remember that the CEO is a more unique snowflake and such, he should be revered more than the others!
 
10:14 PM
I don't quite understand why it is so hard to grasp that a CEO might actually be a hundred times more worth than the average employee. If Google now just replaced their CEO with 100 random people there would be no doubt that the company would go down the hill quickly.
 
@NikiC because it assumes that that the CEO could achieve anything alone or is even remotely responsible for the work of 100 employers
 
An even simpler example is football players / baseball players / ... Do you think that a team would replace their best player with 100 random people from the street? I doubt. So maybe those players are 100 times more worth?
 
@NikiC the best player alone will lose the game. its a team sport
 
@Gordon Yes, I am assuming that the CEO has a good bit of influence and I don't see reason to believe otherwise ;)
@Gordon So what?
 
@NikiC he doesnt. its not even his business steering people most of the time. its what manager down the line do.
@NikiC so the best player apparently is worthless without a team.
 
10:21 PM
@Gordon He is the one who makes the big decisions. By the way, you can follow (using the reverse logic) that as the CEO is payed lots of money he actually is there for a reason ;) No company hires somebody and pays him millions just to sit around in the office.
 
@NikiC Well I often read about CEO's who have plenty of deals on the side leaving me wondering how much time they actually spend on their own company.
 
@Gordon Sorry, I still can't follow. My point was that even if the best football player is only ten times better than the average, it doesn't mean that you can replace him with ten average people. What is important that it is one person and that one person being ten times better can actually be hundred times more worth ;)
 
@NikiC you did follow the news in the past years? managers driving companies against the walls still get paid millions.
 
I think this discussion isn't leading us anywhere ;)
@Gordon I obviously do not support that people should be payed 100x more for doing nothing. But I think that in most cases people are actually payed 100 times more because they are hundred times more worth ;)
 
@NikiC i think your overestimating the worth of the individual in a connected system. and you are somewhat comparing apples to oranges because no one is saying replace the professional with an untrained person.
and i didnt say CEOs do nothing. they do CEO work but CEO work is not worth 100 times more than the work of people implementing the CEO's vision imo. without those people, there would be no business value.
and when you say those people just dont get paid well enough because they have less exposure in a company than the CEO, then thats somewhat cynical.
 
10:33 PM
@Gordon I'm not sure that it isn't 100x more worth. You know, I never really liked Steve Jobs, but after all, he was the one who saved the pretty much grounded Apple and made it into a very reputable and profitable company. If it were for some other person, it could have well been the contrary. Sure, I'm not saying that Jobs alone is to be attributed for this. Without all the other employees there would be little to do. I am only saying that Jobs (generally the CEO) has much more leverage...
... than the average employee. If some programmer at Apple did some really big fault that wouldn't hurt Apple much. But if the CEO does an incorrect critical decision that could well be lethal for the company.
 
@NikiC well, steve jobs salary was $1.
apart from that ten steve jobs without all the people supporting a vision are still just ten steve jobs with just a vision and no product.
 
Uh, I already said that this is leading us nowhere.
 
also, i dont agree that the CEO's decisions are much more risky. of course a secretary might not be able to drive apple against the wall. but a hardware developer creating a faulty iphone that melts in someone's hands would pretty much harm apple big time. and the CEO has no part in that whatsoever. its not like only CEO work is critical. a surgeon in a hospital with a history of surgeries gone wrong has an impact on the entire hospital. even if the director is smart at directing.
 
As I already said, I won't argue further as this is leading nowhere. The only thing I would like to comment on is that a nominal salary of $1 doesn't mean that that's all Jobs gets... though I think that you should know that yourself.
 
@NikiC its a symbolic salary. he had already a fortune through his shares
 
10:44 PM
@Gordon Exactly ;)
 
@NikiC but seriously, do you think he designed all those gadgets himself?
 
@Gordon No, and as I already said: I didn't like him.
Though it's probably more me not liking Apple in general ^^
 
@NikiC yeah, me neither
 
@Gordon nice to agree again :P
By the way, has anything happened about that Motorala Apple thing?
 
@NikiC no idea
 
10:50 PM
Doesn't seem so.
 
if it wasnt on heise probably not
 
11:04 PM
Well, good night now
 
@NikiC night night
 
@Willempie I won't let any shipping company touch a TV... Especially a thin one...
 
11:44 PM
> You've earned the "Necromancer" badge for Cannot redeclare class error when generating PHPUnit code coverage report.
Wuhu!
 
The necromonger in me would congratulate you on your achievement
 
Very nice
 
00:00 - 14:0014:00 - 00:00

« first day (405 days earlier)      last day (4543 days later) »