« first day (154 days earlier)      last day (4798 days later) » 

12:08 AM
He turned. #win
<<< earned going to sleep now
 
posted on March 18, 2011 by Horde news

We started development on Horde 4 almost 3 years ago, and we could probably work another 3 years and still would find things to do and to improve. So we decided to make a cut now and get Horde 4 out of the door. The lessons learned during development also lead to a different release model for Horde in the future.

 
12:41 AM
yay, the piece of garbage has a new release
 
12:54 AM
Holy Shizzle, PHP Finally got an upgrade xD php.net/?beta=1
And why does everyone copy the SO Notification bar these days :/
 
huh?
Oh crud
that's ugly as sin
 
yea it is isn't it
or you can visit: prototype.php.net
 
please tell me they won't muck up the documentation
if they do, I will change to python
 
eee
well, atleast they got the documentation right
 
Its slightly better than the current one
 
1:04 AM
I don't think so
but that's just my opinion
 
At least it looks like it might be designed some time in the past 3 years, instead of 10 for the old one
 
there not finished with it yet, lets see what they come up with
the problem is that all there docs are static, im not sure if they even use a database
 
Yes they do
it's source controlled
it uses a wiki-esque syntax and is auto-generated
 
ahh
well its still static
 
I won't imagining all that stuff being static o_o
 
1:06 AM
it's not
 
so what there doing is just changing the CSS and main frame of the side, meaning it would never look roght
why is php.net's source code so poorly constructed ?
and Zend is so structured ?
 
yeah
 
Hello
 
Goodbye xD
 
Later
 
1:20 AM
i was having a joke lol
 
lol
Any reason you guys don't use the php freaks irc chat room?
It's always lively in there
 
I dunno
what server?
 
/server -ssl irc.phpfreaks.com
 
user1385191
I have a quick question if anyone here wants to help.
 
sup?
 
Tek
Ask away, if someone knows the answer they'll let you know
(most likely @ircmaxell)
 
lol
 
user1385191
I'm having problems with an ISO char I need to convert to UTF-8
 
@MattMcDonald: Looks like JSON, but it's not
 
user1385191
"away_team":"Montr&eacute;al"
 
1:29 AM
You're outputting that?
 
user1385191
yeah, I read it here
 
If I asked a question on SO, am I allowed to post the link here for help?
 
user1385191
I pull data via cURL, parse with DomDocument, and then write it to JSON
 
Ok, do you escape it at any point?
@bigmike7801 sure
 
1:30 AM
1
Q: Help setting up logic for advanced search parameters in PHP

bigmike7801I would like to create an advanced search form much like a job site would have one that would include criteria such as keyword, job type, min pay, max pay, category,sub category etc... My problem is deciding on how best to set this up so if I have to add categories to the parameters I'm not havi...

 
user1385191
no, I haven't modified the data other than trying an iconv
 
I hope my question wasn't too vague
 
@MattMcDonald Show your code
 
I like your QR code ircmaxell
 
user1385191
 
1:32 AM
Help! I'm trapped in a bar-code factory!
 
user1385191
the iconv part I read on php.net's comments section which had a use case similar to mine
 
@bigmike7801 I'd likely suggest either a Bridge and/or a Strategy pattern
interesting, it's not htmlentitied in the raw html
@MattMcDonald try changing iconv to html_entity_decode($string, ENT_QUOTES, 'UTF-8');
 
user1385191
magical
 
user1385191
you've done it again
 
;-)
 
user1385191
1:39 AM
this is the problem I have with PHP: 5,000 functions for every case.
 
Some light reading for anyone interested: <plug type="shameless"> blog.ircmaxell.com/2011/03/… </plug>
@MattMcDonald No, they are actually different functions. iconv converts between character sets. html_entity_decode decodes html entities in the string
 
user1385191
oh ok
 
user1385191
this blog post is reminding me of when I was looking through the dojo source code this morning
 
user1385191
they have a big function that does a ton of browser sniffing
 
user1385191
and one of the comments in the file says something like "this really isn't a good idea, we should try something else"
 
1:41 AM
Yeah, there are loads of examples of that everywhere
 
here's some free icons I made if anyone is interested <plug too> tutsoup.com/freebies/free-web-app-icons </plug too>
 
very interesting
 
what's that?
 
those icons
 
oh
why is it interesting?
 
1:44 AM
they are nice, and free. So that's interesting
 
user1385191
you'd be better off doing those in illustrator and saving them as something scalable.
 
user1385191
they look good for the most part though
 
Not if I don't want them to be scaleable
thks
 
lol
 
why did I get a voteDown here? I made a long answer and a useful function for him in addition. stackoverflow.com/questions/5334029/…
 
user1385191
1:46 AM
why the extra answer?
 
To get extra vote up :D
haha
 
user1385191
your vote down is most likely because your second answer was just lazily posting a link
 
booo
 
it's not really applicable in this case though
 
I am new to stackoverflow, but this might have been the reason, thx for explaination. It made me angry, that I used time to help and I got founded.
 
1:47 AM
Well, I don't care for most blind downvotes
 
Matt, look if you took the effort first to write a long post ...
 
but link-only answers are highly discouraged
Even add a few words explaining why the link is the correct answer, and you might get upvotes
 
I am hunting for votes, real life leveling :D
 
Exactly
well, kinda
 
I am stopping now to fool around with links to my answers but look at this weird stuff, what I made for this dude, but ok, I got it wrong. I thought he is using mysql :D
sadly no reaction yet =)
0
A: removing duplicate in table

tokamIf you do not like doublicate values in the database, you maybe should set an unique index. I have tested a complicated query for you which removes all dublicates in the table test which have an equal name. The one with the lowest id will not be removed. You have to create these derived tables ...

 
1:50 AM
it's a duplicate
most duplicates are not upvoted
since they will likely be deleted
 
what is a duplicate?
 
meaning there's another question that answers the exact question already posted
 
:( a fault of the guy asking.
 
See the top of that question
right
 
this mysql query looks funny.
subselect + 2 derived tables + self join =) + sorting :)
 
 
1 hour later…
3:11 AM
posted on March 19, 2011 by blog.phpdeveloper.org » PHP

It’s easy for us to look around at the technology we work with every day and think that we can solve all of the worlds problems with a few lines of elegant code. We think that just because we have a mastery of our language of choice, that we can conquer any challenge we might face. The only problem is that we’re forgetting one thing. No matter how much code you write or how much time you spend

 
 
7 hours later…
10:26 AM
posted on March 19, 2011 by blog.phpdeveloper.org » PHP

It’s interesting – sitting here writing a few emails, sending a few tweets – I was reminded of a me from not so long ago. He was the one that tried to convince you that conferences aren’t about the talks. He pointed out that the real key to conferences was the people you met there. I’d sort of forgotten him until just this morning, and I wanted to invite him back to the stage. See, the key to

 
 
2 hours later…
12:15 PM
0
Q: php selecting bulk email and post

boyee007ive got over thousands my clients email in database. sorting the email with php: $q = $db->query("SELECT email FROM user LIMIT 200"); while($r = $q->fetch_array(MYSQLI_ASSOC)) : echo '<input type="checkbox" name="emailList" class="useremail" value="'.$r['email'].'">'; endwhile; ...

 
Facing an issue with array_diff_assoc
I have following arrays
Array ( [privacy] => Array ( [option] => 2 [password] => ) [guest] => Array ( [option] => 0 ) [closevideo] => Array ( [option] => 0 [days] => 0 [date] => ) [notify] => Array ( [option] => 0 ) )
Array ( [privacy] => Array ( [option] => 0 [password] => ) [guest] => Array ( [option] => 0 ) [closevideo] => Array ( [option] => 0 [days] => 0 [date] => ) [notify] => Array ( [option] => 0 ) )
When I am comparing above two arrays with array_diff_assoc function, then I am getting following output
Array ( )
Why is it so, is it due to multidimensional arrays? what can be the solution for this?
I am basically comparing both arrays so if anything changed I'll get to know that some changes in the data is occurred.
Please help....
 
1
Q: Why does array_diff on arrays of arrays return an empty array?

EldrosI've got two arrays, for which var_dump give the following values: $array1: Artifacts:array(2) { [0]=> array(3) { [0]=> string(7) "module1" [1]=> string(16) "path/to/file.txt" [2]=> string(0) "" } [1]=> array(3) { [0]=> string(7) "module2" [1]=> string(17) "path/to/f...

 
12:41 PM
Isn't there any other easy way, instead of writing whole function? Is it possible to get all values of array in plain text and then compare them? Or similar logic?
 
0
Q: HE-Wall plugin 3.26 not working social engine

ntechiHello everyone, I am having a question with social engine website, I need help, I purchased the Social Engine HE-Wall plugin 3.26 and when I inserted the code {he_wall_display object='userhome' object_id=$user->user_info.user_id} in user_home.tpl file, nothing seem to be work. Then I search...

 
12:55 PM
Just array map a serialize function. That way it turns into an array of strings...
 
guys, how do i get Models within autoload when using Zend. I have a application/modesl/user/guest.php and aim to call it with User_Guest(). I thought $autoloader = Zend_Loader_Autoloader::getInstance();
$autoloader->setFallbackAutoloader(true);
would work
 
It's not Zend. It's Zend Framework. See stackoverflow.com/tags/zend/info
 
Meh, why is it everytime i do anything with Zend it breaks !! Humpf!
 
Because you are doing it wrong.
 
1:10 PM
ha, thanks Gordon, very helpful, can you not see what i'm doing incorrectly :)
 
No. There is not enough information in your question. The only obvious thing is that you have a typo in the path you show (modesl instead of models). But apart from that I'd need a Crystal Ball to spot what's wrong. For starters: what's wrong at all? And please don't answer that with "it's not working". Details please.
it's all about asking the right questions ;)
 
Yup. Describe your problem... (I should write a blog post about that)...
 
Hi everyone!
 
sup?
 
I have a... small question... I am creating class in PHP and when error occurs what should i use: Die() or throw exception?
 
1:20 PM
Well, you shouldn't ever use die
 
Why not?
 
but whether to use exceptions or return an error status is dependent upon the situation
Because errors should be able to be handled. Or at least display a pretty error message to the users
Not to mention that for security reasons you shouldn't tell the user what actually went wrong
 
Yeah, but handling errors when dies is 'or die(..)' or he can just f**k my die by inserting @[at] at beggining. When exceptions he have to use try.. catch..
Or fatal error occurs
 
huh?
 
For example function foo() when occur error will use die():
foo() or die('some handling').
or jus @foo() then nothing will appear
And when using Texceptions
try{ foo(); } catch(Exception e){.....}
 
1:24 PM
@ shoudln't be used either. I wish it was not in the core. It's a major sign of code-rot IMHO
 
So could you tell me normaly: die or Exception, 'cause i've undestood that i should use Exceptions... right?
 
Exceptions are used for exceptional circumstances. Not all errors are exceptional circumstances. So they shouldn't be used for all error conditions
but die() shouldn't be used ever since it forces how the error is handled, rather than letting the user of the class decide...
 
Umm if i have condition that checks $path is directory, when not, Exception should be thrown?,
 
Well, I would throw an InvalidArgumentException if $path is supplied as an argument...
 
Cool thanks :D
 
1:29 PM
@Robik see it this way: when you use Exceptions and they are not caught, the script will die anyways, so it's nicer to throw Exceptions and give people the choice to eventually handle the error. If no one does, it dies. So in the worst case, Exceptions are a better die.
 
The only time die() should ever be used in code is if it's literally impossible to recover from what happened. An example might be if you detect a hacking attempt. It might be safer to end execution on the spot than to try to send a nice error message. But again, that's a stretch...
 
Thanks to all! I always had a problem which to select. Now i know. @ircmaxell i know it that die should be used on hacking attempt but any way thanks for advice.
 
I said could. You may want to do something else.
such as try to log it, try to capture relevent info, etc
 
function askQuestionInChat($question)
{
    if(FALSE === isRealQuestion($question)) {
        if(use_die()) {
            die('Not a real question');
        } else {
            throw new NotARealQuestionException('Not a Real Question');
        }
    }
    return findAnswerToQuestion($question);
}
try {
    $question = '…';
    askQuestionInChat($question);
} catch (NotARealQuestionException $e) {
    $improvedQuestion = improveQuestion($question);
    askQuestionInChat($improvedQuestion);
}
 
Not recursive enough
 
1:42 PM
hopefully illustrates the point though
 
yeah
function postQuestionToChat($question) {
    try {
        askQuestionInChat($question);
    } catch (NotARealQuestionException $e) {
        $question = improveQuestion($question);
        postQuestoinInChat($question);
    }
}
 
Yup all is right. Thanks again.
 
cool
 
By the way: I have asked cause i want make my project more pro.
 
@Robik Buy a book by Martin Fowler then
 
1:53 PM
Morning
 
@edorian morning? did you move to @ircmaxell now?
 
I got out of bed 10 minutes ago so it has to be morning
 
lol
 
See: convention over configuration
 
I can't buy books im llearning from net.
You know i know enough now.
It was just my (Google Translated:) dilema.
 
lol
 
Pie
 
Yeah, that's a good one
 
1:58 PM
Next noobish question: if i have some misc functions, it is worth to put them to Misc class and make them static?
 
That reminds me.. i could spend the day reading
 
Question for pro PHP-ers.
 
Nice question @Robik :) Interested to hear @Gordon and @ircmaxell take on Util classes
 
Well, IMHO it depends. I tend to use very few raw functions
 
0
Q: time picker in php

user667340Hello everyone . please help me out regarding time in php. I want to make time selection for a website that offers their services at different time . I want to make it like a date picker calendar . I haven't find anything yet . i can make in drop down box but showing the 60 min drop down looks qu...

sigh
 
2:00 PM
If i have to select beetwen joinPath() and Misc::JoinPath i will select second and you?
 
takes l33t sk1llz to u$e teh G00gl3!
 
@Robik: I would select neither. What does joinPath do?
 
@robik no. Utility classes are a Code Smell. Group/Make them into their own proper classes. Otherwise you risk them becoming a God Object.
 
So where to i point my StringStartsWith, StringEndsIn and Array2DJoind ? To i really create a String and an Array class?
 
@robik also static methods will most of the time make your life miserable in the long run. avoid them
 
2:03 PM
Yes.
 
yes
 
$string = new String($raw);
if ($string->startsWith($blah) || $string->endsWith($bar)) {
 
kinda fells wrong to do so in php
 
why?
 
good question .)
 
2:07 PM
Well, admitidly for string functions it feels overkill
but for array helpers, etc it could be really nice if architected correctly
 
So, static functions = evil?
 
for startsWith one could argue that strncmp is already there, for endsWith that gets harder ...
And well testing isn't going to be pretty.. and I'm not going to inject a stringFactory am i ?
 
I mean misc functions, redirect etc... but if static functions are evil i will use functions.
 
2:08 PM
Well, I don't know I'd go so far as evil, but they aren't the best practice
and functions are no better (in fact, they can be worse)
 
at least they are when using them between classes
 
It's just your take on the subject because we like testable code
 
By the way: some one which can edit please modify because there are 2 methods 1.
 
2 methods 1?
 
before you use plain old functions, use objects with static functions, but rather use objects with normal function because then you can test certain stuff easier
@ircmaxell what @Gordon linked
 
2:11 PM
I don't understand, I'm looking at the question
ahh fixed
 
I mean 2 time: 'method 1'
 
yeah, I saw that, fixed
 
Umm so that i understand is: functions > static functions > global
Where > means is higer/better than
Last what should i do is global?
I'm lost now
 
real functions > static functions = functions > globals
 
I'm hungry
 
2:18 PM
ok, off for a while. Gotta go shopping for a new router
 
from the things you gain/loose in terms of maintainabilty and testabilty and other things i value
 
@ircmaxell have fun
 
thanks
 
@edorian What exacly do you mean by real functions
These from standard.php/core?
 
methods of an object
 
2:19 PM
Oh
Thanks!
 
@edorian do you know if darksiders on steam is any good?
 
My beloved hateful game critic has his take on the subject
unclebob of games, if you will
 
@edorian thanks wont buy
bwahahahasobsob
1
A: time picker in php

Dr McKayUse HTML5, it natively supports date pickers and all time-related inputs. See http://diveintohtml5.org/forms.html

so when I use HTML5 my IE6 will show a datepicker?
 
But beaware that yatzee is really mean to games, you get a trustable opinion but he doesn't say nice things very often
sort of what i'm trying :D
HTML5 build or down datepicker is really mean .)
 
@Gordon The only browser that properly supports that is Opera
Chrome's and Safari's are worse than useless, Firefox 4 doesn't support it
 
2:33 PM
@YiJiang thanks but that wasnt an actual question, but sarcasm
 
I know, but the support is bad enough that even if you want to support only this generation of browsers, it would still fail miserably
 
well, tell the OP :)
and dont forget to cv the entire thing ;)
 
does suggesting using an html5 datepicker in 2011 qualify as trolling?
 
i consider suggesting to use html at all trolling
 
@edorian Read above, browser support is nil right now
 
2:37 PM
@YiJiang But do i switch to the default assumtion (incompetence) or is that evil spirted usually ? :P
(Mostly joking, i don't thing the guy answering had bad intentions)
Feeding time :) See you later
 
 
1 hour later…
3:58 PM
wprd
 
4:21 PM
Next question:
is link like that Seo-like: address.com/?Part=/entry/view/1/ ?
 
5:01 PM
@ircmaxell or @edorian can I have upvote on my last comment to stackoverflow.com/questions/5166087/php-global-in-functions/… pls. Would like the rebuttal to bump into the 5 visible comments.
 
Hi
 
5:48 PM
I've given my votes on the point
off now
 
@edorian thanks
off now too
 
Tim
6:20 PM
Good morning!
 
Hello
 
 
1 hour later…
7:44 PM
Hi please I have a question: stackoverflow.com/questions/5337434/…
It's about Apache mod-rewrite and PHP. Can't seem to get my head around it :(
 
 
2 hours later…
10:00 PM
is someone here?
 
hi
 
edorian
can you help me please?
 
not sure, ask and we'll see :)
but i'll try
 
have you read?
 
no clue, havn't used eclipse for years
and even than not on a mac. Sry :)
 
10:04 PM
pff :'(
why is it so hard to run a f***ing simple php file
hate developing on a mac
 
does it work without the ide?
 
how could this happen
how will it work without IDE?
 
running php test.php from the cli ?
 
how goes it?
 
cli?
 
10:09 PM
command line
 
never used this
 
@ircmaxell fine :) catching up on house md atm
 
Very good
 
pff no one can
 
11:09 PM
posted on March 19, 2011 by Jacques Marneweck

I'm a keen believer of learning from other folks mistakes and attempting to not repeat them. Source code disclosure and even worse configuration disclosure which happened with tumblr. One thing to remember, if you keep your configuration for your app...

 

« first day (154 days earlier)      last day (4798 days later) »