« first day (748 days earlier)      last day (4206 days later) » 

12:01 AM
okay, this is a little mad:
$categories    = $vpath('//category[not(. = following::category)]');
$subcategories = $vpath('//animal[category = "%1$s"]/subcategory[not(. = following::animal[category = "%1$s"]/subcategory)]', [&$category]);
$animals       = $vpath("//animal[category = '%s' and subcategory = '%s']", [&$category, &$subcategory]);

foreach ($categories as $category) {
    echo "=== $category === \n";
    foreach ($subcategories as $subcategory) {
        echo "  = $subcategory =\n";
        foreach ($animals as $animal) {
0
A: Create nested list with PHP from XML dataset

hakreThere are literally a thousand ways how you can do that. Most straight forward is probably with xpath(). It's a powerful XML querying language worth to learn. Example with your $xml simplexmlelement: foreach ($xml->xpath('//category[not(. = following::category)]') as $category) { echo "==...

 
@tereško just my response to @Lusitanian's statement.
 
there was no such thing
 
@hakre you mad
 
/me doesn't like trees that are actually stored as graphs of objects
 
XML?
 
12:08 AM
@webarto Well, probably. I did 5 or so different versions. The xpath variant had the least code, but the foreache's didn't look nice for templating so I came up with that.
 
user1125394
yep his tree looks like array
 
@hakre That made you a better programmer now... now you know which variant to take. And you are mad :P
 
user1125394
 
12:26 AM
What will we do with mad @hakre (x3) Early in the morning
@tereško what does return; returns by default? I would guess false.
 
null
 
falsey, right... thanks :)
function a(){return;}
var_dump(a()); # NULL
That is bad I guess...
 
what is bad about it? if you omit the return you get null as well. null represents "no value" which is exactly what is being returned.
maybe I'm missing something?
 
seems all fine that if return is without a value it does not return anything. Like exiting a function:
function a(){}
var_dump(a()); # NULL
Btw, why is # being deprecated as comment?
 
in ini files?
 
12:44 AM
@igorw I know, but what does it represents, what does null means, operation completed successfully or not?
 
@hakre It is being deprecated O_o ?
 
@webarto returning false is a horrible way of handling errors. It makes your PHP code look like C, where you need to check the return value of every call. Exceptions are way superior imo.
so I would say that null indicates success, whereas an Exception indicates an error.
 
@hakre i didn't even know that you could use it in PHP
 
@igorw hmm, what has ini parsing to do with PHP code?
 
12:47 AM
O_o # for life :P
 
@hakre that's why I asked if you meant it being deprecated in ini files.
 
#######################
# Super Comment Boxes #
#######################
 
is it being deprecated in PHP code now?
 
@igorw maybe I mixed that. :/
@igorw I have not seen any warning so far in my PHP 5.4, so I guess not. I must have misread something. Maybe a warning related to ini parsing and I thought it was PHP code.
 
where did you get this rumour from?
 
12:49 AM
@igorw NULL is still pretty much false, majority PHP functions have boolean return, of course Exception is desired, but not everywhere...
 
@webarto well, there's a reason why you should always use === when checking for boolean return values.
 
also , while on subject of comments , i hope you guys know this trick : pastie.org/5169605
 
Variable Code switching :D @tereško THANKS
 
user1125394
@tereško php only?
 
@cyril available in all languages which support /* ... */ and //... comments
 
12:53 AM
@igorw from the internets ;) - Just a misinterpretation of mine I guess.
 
Maybe not advised to use, as a preference, but it doesn't hurt anyone...
 
@webarto it's a nice tool when you are tinkering with and comparing two large pieces of code
 
user1125394
kthx for the learn, great for pissing off other devs
 
@hakre omfg the internets? must be true then.
 
@tereško I'm currently typing a code like that, so in the right moment :)
 
12:55 AM
@igorw yes more than true, trues.
 
one should get paid for doing this
.. oh .. wait .. there was such a thing. It was called "experts exchange"
 
I don't mind paying for precious information.
I'm 1337 now.
 
@tereško you mean expert-sexchange?
 
yeah
 
user1125394
@tereško what is your consultancy /hour rate? :D
 
1:03 AM
virgin per hour
 
user1125394
If I count my hours ofwork, I'm like 10eur/H
 
Money is a distraction.
 
user1125394
1800/(4*45)
 
for the exception discussion, I found this reading not bad: blogs.msdn.com/b/oldnewthing/archive/2005/01/14/352949.aspx
 
user1125394
only Indians beat me
 
is there anything special about
 
Jess McKenzie, Auckland, New Zealand
1k 3 26
I have the strong feeling that this user is immune to learning anything. 297 Questions and most of low quality.
 
@cyril shut up, that is not bad at all...
 
user1125394
ah forgot eastern europe :p
 
user1125394
1:12 AM
@hakre the blog itself is 'hard' (css) to read, but interesting
 
@cyril disable author styles or just open up in terminal. ;)
 
@hakre tomorrow there will be a new question on meta "People are targeting me and deleting my questions!" :-p
 
@Jocelyn I hope so :P
Oh is it that guy?
 
I had a quick look to his 297 questions
most of them are about php, html, javascript, mysql
 
1:15 AM
^ what else is there :P
 
there are lots of awful questions
@tereško what will this tag exactly cause?
 
That is time consuming and frustrating, I couldn't do it for money... Good night Sirs...
 
@Jocelyn nothing .. but you can search by it
 
good night @webarto
 
user1125394
1:20 AM
@hakre his descr : Feel bad about having so many posts on here but the only way you get to learn is by taking it in and asking questions.
 
@cyril yeah. every third question is how to access a tag or attribute with simplexml. Hmm. Really taking it "in".
 
@tereško i believe it was you who linked me to a codeangle article on how to craft a template class. Thank you. I finally understood why he'd prevent to set/get that variable (i dont think he needs to, but understand why) and finaly got up to craft "my own" template system :)
 
if you sort the questions by number of votes, and start from the last page, you easily find the ones to closevote
 
1:24 AM
@MoshMage: Congratulations.
@Jocelyn Ah the CV pro is speaking ;)
 
Thank @hakre
(and i'm loling at "Microframework (n) a small amount of crap")
 
user1125394
You've missed fundamental knowledge of the language. php.net/manual/en/language.types.string.phpCorbin Apr 10 at 4:42
 
@MoshMage yes , though I would avoid use of magic methods. In long run they might get confusing. prefer for template t implement setParameter() and appendParameter() methods and there is no real point in actually having a getter there anyway
 
@cyril Yeah nice comment, I read it some minute ago.
 
@MoshMage , when writing code, you should always follow the principle of least astonishment
 
user1125394
@hakre probably Stack Overflow can be unburden from this question
 
@tereško yeah. it took me a while to understand the magic methods, but then i felt sooo elite. I did come about the appendParameter() problem (and was still thinking how to fix it - thanks btw) but i avoided the need to append (until now anyway :P)
but all-in-all is a nice place to start from :)
I am also reading on that principle right now.
 
the article explains the concept and gives to one (neither best nor worst) of possible implementations
 
I wonder how that guy achieved to get 1k reputation.
 
1:32 AM
@hakre , my common-sense is tingling ... it looks like he will soon be under 1k again
 
@tereško no, he is going up
 
someone is upvoting him a lot right now
 
okay LOL
that guy must have a sockpuppet.
 
he earned 49 today
 
flagged with voting anomaly one of his answers.
already 77 now.
 
1:35 AM
it goes up very fast
 
i think he just performed a seppuku
 
:-D
 
Anyone Handy with Wordpress Theme Coding, trying to customize the appearance of password protected pages and hitting a brick wall
 
I hope he gets banned for three month or so.
 
Sup @tereško
 
1:37 AM
@ert3 what do you mean?
These posts that have a password?
 
trying to theme this
http://codex.wordpress.org/Using_Password_Protection
if you get what i mean
 
we do not deal with WP here
 
well its a php room
:)
 
and we have standards : no worpress , no phpnuke , no phpbb , no drupal
 
then why are you hear m8
:)
Also it was one of you guys who told me i should use wordpress and learn how that works instead
what about e107
Joomla
 
1:39 AM
joomla actually ranks way above codeigniter/cakephp in my opinion
 
JSON
 

 The Loop

Where humor doesn’t work.
 
@hakre i loled. is PHP's topic "Where humour always works" ? :P
 
JSON is a data format, not a programming language
 
1:41 AM
@Jocelyn ho, what do you tell! ;)
 
@Jocelyn thank you i was hunting the proper word down in my mind for it
 
OH my god its almost as if json does something php can already do
 
@tereško he's going to restart his upvoting machine I think :-p
 
> Jess McKenzie is holds a diploma of web development from the Yoobee School Of Design . Along with this and his many years of experience he can help you create a website that works to promote you and your business.
Looks like he forgot to mention stackoverflow along the lines.
 
1:43 AM
@hakre brought to you by coke lol?
 
Why am i downvoted on this topic stackoverflow.com/questions/6273338/… ? and.. should i just remove it or keep it for others sake? :o
 
I need to fix up my about page
stack has a reference from me in there
 
@MoshMage nah keep it.
 
@MoshMage , possibly some revenge-downvoting , people tend to downvote question, because downvoting answers costs rep .. the to only question that i have asked have -9 , each
 
@MoshMage some people just downvote cause they mad
 
1:44 AM
@hakre Forget this humility. According to Jess, I can call myself a Senior PHP Dev!
 
@tereško and thats what turns stack into redit
 
@SomeKittens Here is you PHP Senior Platin Certificate of Software Engeneering. Congratulations. ;)
 
@tereško wait, PHP has standards? LOL!
 
@igorw some , but what is more important , php developers in this chat room have standards
 
@tereško dang! that "makes sense"
 
1:46 AM
@tereško no fat chicks.
 
^ lol.
 
@SomeKittens i am quite sure, that would be a matter of preference
 
Who am I kidding. We don't have any women here anyway (unless you count all the times people have called @tereško female).
 
@tereško well, I'm representing phpBB. deal with it ;-p
 
1:53 AM
screw you , I'm gonna go back to coding and listening to "Draconian Times"
 
@igorw wow.
Welp: I'm going. just hopped on to thank @tereško for "pushing me" into php oop :P
and on the standards: I'm trying to create "my own" 'small amount of crap' so.. i haz standards? :D
 
if each time what you write gets better, then yes , you have standards
if you look back to your 3+ month old code and go "yep, this is just perfect" , you have no standards and no future
 
/me is happy to announce he has standards! :D (tho there's no real proof of that xD)
 
@MoshMage yeah , but currently your standards have only one guideline : "make it suck less"
 
my 3+ months code is a mess; That's why i started to try and make my own framework: so i can not be a messy coder and have default stuff to work with [instead of rewriting the same function every other day)
and lol at "make it suck less" xD
 
1:57 AM
@SomeKittens and the people who call @NikiC female
 
blame the movie/series
 
new question from a new friend. I only say !important
 
OOOH! Some one upvoted my sqlite3 topic! Thank you so much :D
 
@MoshMage , watch this lecture for your edification: youtube.com/watch?v=4F72VULWFvc
this would be the next step in learning OOP
 
@tereško your links are always awesome. I wonder if you keep them in a magic bag or just in your bookmarks :P
(aka thanks!)
 
2:02 AM
mostly bookmarks .. i think i currently have 6000+ of them .. though programming-related stuff is only small part of it all
 
well, like i said before: I'm going or resting time will be diminished and we dont want that - i like my sleeping before things :)
'night you all. Thanks once again teresko :)
 
he removed his question
 
jow, comment was:
> Yes like with nearly the other 295+ questions you've posted so far. Also your rep does not behave normally just around the corner. Anything you want to say about it? –
 
I think his profile will undergo a major reputation change in less than 24 hours
 
2:09 AM
@hakre Interesting. That comment was added, then the question was removed. And the reputation history is obviously not legit.
 
we caught him with the fingers in the cookie jar
you can nearly cv 99% of his questions, I only concentrate on the PHP tag now
 
According to the recent reputation history, he got upvotes on several different questions in less than a single minute!
 
@Jocelyn I already flagged him.
^ how does hosting a website work????
 
we are going to spend all our daily closevotes on his questions...
 
right, we just should call a moderator later today. I need to get some sleep ;)
 
I need some sleep too
and I'll try to get up before sunset...
 
well that guy is so sweet. Just found a double-post on SO and wordpress.se
 
is he asking there the same kind of hopeless questions?
 
That was amusing: someone edited a question, changing <? to <?pho.
Um, <?pho? PHO? Is @SalmanA programming in PHO? — Shaquin Trifonoff 4 mins ago
 
2:44 AM
I would love to know what the sock-puppet of that Jess McKenzie is. Not that there is another user asking these questions.
 
'night.
 
if(!$me) die; // Prevents other people trying to access pages
 
Hey guys, is there any forum like stack overflow for application specific help?
 
@ShaquinTrifonoff Can be circumvented by using register globals ;)
@Stax stackoverflow is not a forum.
But you might be looking for superuser - superuser.com/faq
 
2:59 AM
that's why I said like, maybe my sentence structure was bad.
I didn't mean to say SO was a forum, but I wanted the forum equivalent
like if I have a question about how to setup my database structure. I obviously can't ask that on SO as it is too localized.
 
@hakre Not with $me = false; at the start though.
 
@Stax well I'd say that if you formulate a question in a way that it has use for a larger audience, then it's not too localized. However you need to find these general points in your decision making. But then it's not too localized.
For pure database design there is: dba.stackexchange.com
 
@hakre ok thanks
 
Finally, some action!
> -71 9 mins ago reversal Serial upvoting reversed
 
3:12 AM
ah. just seeing I have a "helpful" flag feedback for reporting the anomaly
 
3:35 AM
> -5 22:42 removed User was removed
Weird... on Oct 19.
 
user50049
@ShaquinTrifonoff That just means someone that upvoted one of your questions no longer has an account, thus the votes were removed.
 
@TimPost Thanks, I didn't know that :-)
 
user50049
It's one of the more confusing messages we have.
 
hi @TimPost
we were "stalking" the user named Jess McKenzie a little.
Turns out that each time he get's some dv's because of asking low quality questions (and he does a lot), he suddenly get's upvotes.
It's really a miracle how that user has 1k+ rep with so many really crappy questions.
It would be probably helpful if the user couldn't ask any more questions until having at least 10 accepted answers. Or something like that.
 
user50049
4:01 AM
@hakre The new /review system is part of the reason why you see pure crap getting up voted, as more people that write crap are reviewing someone else's crap. Taking a look though
 
@TimPost well with that user it's really sad. I have the feeling that guy is running his webdesign shoppe on top of SO ;)
btw with the review system, I see that with the first questions reviews.
 
user50049
@hakre There's no real abnormalities in voting. Let me go through the question history and I'll see if I can help them a bit. Thanks for pinging me.
 
@TimPost thanks for taking a look. I was probably picky with the voting stuff because there was a huge dissonance just 1-2 hours ago.
It got resolved, I did flag one of the answers involved in it.
 
user50049
@hakre The new /review has definitely shown a bit of a twilight zone effect. Normally, when I see a pure crap question or answer get several votes I immediately think there's a vote ring going on. Took chasing quite a few wild geese after they changed review to realize what was actually going on.
 
4:48 AM
`code`if(!mysql_select_db($database)
{
exit('Error: could not select the database');
}
That didn't work >.> - Anyway, I'm getting "Parse error: syntax error, unexpected '{" for that.. I think that all works..
 
@GeorgeSumpster You forgot a ) in your if statement.
BTW, you should be using PDO too.
 
Does it come with PHP standard now? Because I'm not sure how I would go about installing it with GoDaddy
 
@GeorgeSumpster If you have got Linux (not Windows) hosting with GoDaddy PDO will be enabled by default.
 
@ShaquinTrifonoff Alright, sweet. I'll look into it. Just curious, but PDO v. MySQLi? I think that's it, but which is better for what I'm doing, which is creating a forum
 
@GeorgeSumpster Generally, PDO is recommended if you are switching from mysql_*.
 
4:56 AM
@ShaquinTrifonoff Alright. Thank you.
 
5:09 AM
I seem to find the tutorials that are.. uuh. Broken to say the least.. net.tutsplus.com/tutorials/php/…
 
@GeorgeSumpster Almost all of the online tutorials are bad. Read the PDO docs on PHP.net for information on using PDO. And I see that you copied invalid code from that tutorial :P
 
Mmhm. That's why I then looked ahead and saw more errors and now I've just taken a view of forums aren't really TOO complicated, that tutorials has the basics in it. So, I think I can do this without a tutorial and just google or ask what I need
 
@GeorgeSumpster That is a good idea.
Also, don't use the 'encryption' in that tutorial... they are using a hash function with no salt, so it's easy to crack with rainbow tables.
 
@ShaquinTrifonoff Alright, what should I use instead?
 
5:29 AM
@GeorgeSumpster bcrypt. Ask @ircmaxell (he's not here right now, unfortunately).
That's a presentation that he made about passwords.
 
^he recommends crypt
 
5:56 AM
@ShaquinTrifonoff Thank you, learned quite a bit there.
 
6:36 AM
Quik Q How to hide div first then show in jQuery Toggle api.jquery.com/toggle
 
7:17 AM
throw new ContextException('Some error occurred...', get_defined_vars());
That seems to work nicely (I wrote the implementation for ContextException: it basically extends RuntimeException and expects a context as a second ctor argument, also has a getContext() method).
My problem? Why doesn't PHP already do this kind of functionality by itself?
Now I'll have to have a whole set of exceptions re-implemented to make use of this feature (eg; InvalidArgumentException would become InvalidArgumentWithCtxException, etc).
 
@Christian Wouldn't that only return the variables at the point where it is caught? I'd also be careful of that when you tried to write any output that has circular references in it (because that may cause errors itself).
 
@Paul Caught? No. get_defined_vars() gets them upon object creation.
I'm unsure about the writing part, but I don't think it should be an issue.
 
I'd have though it was at the point where the function was called.
 
@Paul Well, it would have been convenient, but that's not possible. You have to pass on the variables.
Though I'm sure PHP would be able to do this without having the user actually pass said variables - just as it works with errors.
 
7:33 AM
@Christian oh, i see, yes. What was I thinking? Of course that works.
 
@Paul Well, from first thoughts, I don't think this would conflict with any PHP code if they decided to add this feature to existing classes?
 
@Christian It is assumed that you will just use the message string (which isn't so unrealistic).
 
Something else I'm wondering about; why doesn't InvalidArgumentException extend RuntimeException (it extends LogicException which extends Exception)?
 
fair point.
Personally I stick close to the standard PHP implementation. Then no-one needs to worry about pulling in all of my specific exception classes if they want to re-use something that I've written.
Some people consider it a leaky abstraction to not have specific exceptions, but it hasn't bothered me so far.
 
@Paul Well, in my particular case, if it weren't for the context issue, I wouldn't have needed another type of exception... I could have easily just used the existing exceptions classes.
@Paul Usually such exceptions would be found in libraries or frameworks...in my case, it's the application itself... and it really didn't need its own exceptions (hence why mine is named after the context feature, rather than application name).
 
7:51 AM
@Christian I see, then everything should be good. Just don't use my favorite output function var_export to write them.
var_dump can handle circular recursion.
 
@Paul Actually, I am outputting them.
To solve the recursion issue, I'm doing something like this (array implementation):
 
i just like the look of var_export, but it makes more sense to just use var_dump rather than something custom?
 
function prnt($ar){
    static $beenthere = '__recursion_protect__';
    if(isset($ar[$beenthere]))echo 'Recursion!';
    $ar[$beenthere] = true;
    foreach($ar as $k=>$v)if($k!==$beenthere)prnt2($k, $v);
    unset($ar[$beenthere]);
}
@Paul It's custom because I've got a UI implementation for unhandled exceptions.
So far, it seems to work well.
 
@Christian I have a system wide exception handler that prints lots of details on development machines. I found I wanted to limit the output by cutting at a halfway point if it got ridiculously large (I have it set to 6000 characters which is enough for me). The rest goes into my log file.
 
8:16 AM
Why is Exception::getTrace* final?! :(
The guy(s) designing the core Exceptions deserve a good kick in their ass...
getFile/Line/Message can be circumvented by doing $this->file = $newfile;
 
what would you prefer, returning a html response on a ajax call, or a json object ? for a search function?
 
Depends on what you're doing.
But even if it's HTML, I'd wrap it in a response object (JSON)
something like this: echo json_encode(array('success' => true, 'response' => $html));
 
8:32 AM
ah i see, i think i need to be better at json handling,
 
JSON is pretty much made for that.
 
See, returning a JSON allows for future modification of response without breaking compatibility in your code. If instead you returned just a string of HTML, you won't be able to distinguish between responses.
 
Sorry, not much time now for a proper answer. :( But hope my comments above get you started. If you want you can quote me in your question and ask for further advice.
 
yeah, thank you
 
8:40 AM
5 hours ago, by Tim Post
@hakre There's no real abnormalities in voting. Let me go through the question history and I'll see if I can help them a bit. Thanks for pinging me.
@TimPost .. so .. did you look at the user history ?
notice the 100 rep that was magically gained in few minutes ...
 
/me puts winter tires expecting snow, suddenly 20*C outside.
 
@webarto I guess you actually meant -20C, right?
 
@Christian Nay, it was ~0 for a few days, and now it is 20*C... and in few days again it will be ~0...
 
@Christian i.imgur.com/AMa3x.png dat snow
 
8:47 AM
@tereško Ow! I always wondered how to create an <a> tag with Zend Framework!
@webarto Looks like fun....my only experience with snow was the start of snowing in switzerland. People thought I was crazy when I kept gazing at a few flakes on my hand :D
Instead of snow, we do get a lot of sand. Not as much fun though...it always seem to stink of rotten fish. :(
 
Dem Maltans ... snow is nice if you live in Switzerland :)
 
Monring people
 
morneing
 
@PeeHaa Bongu.
For a second there I thought @hakre posted that question.
Guys, got a question. So, I've got a ContextException and I need to create a ContextErrorException one. Should ContextErrorException extend ErrorException, or ContextException. Sounds like it's a good place to use mixins...but it's too early to support it....so I'll have to decide on just one class. What do you think?
 

« first day (748 days earlier)      last day (4206 days later) »