« first day (717 days earlier)      last day (4228 days later) » 

2:00 PM
.. and you missed it
i consider css layouts like "unholy grail" as tricks
nevermind .. misread it
 
user1125394
Can I ask what is for you the best way to indent code 1 tab (4 spaces), 2 spaces, ..?
 
@cyril 4 tabs XD
 
@cyril Up to personal preference really,
Definitely not tabs
 
@MadaraUchiha Huh? Personal preference but not tabs?
 
@cyril 4 spaces
 
2:04 PM
i kinda like tabs , but have to use 4 spaces
 
I like to use 4 spaces, that's also the most widely (AFAICS) convention out there.
 
a decent editor will let you tab key to generate 4 spaces
 
@Christian Yes, the problem with tabs is that they render differently from software to software.
 
@MadaraUchiha That's the whole damn point. Want tabs the size of 4 spaces? options > preferences > editing > tab size = 4 spaces. Your editor doesn't have that feature? Well then, it sucks.
 
Sem
2:05 PM
 
@Christian By "Personal preference" I mean, be it 1, 2, or 4 spaces
 
@MadaraUchiha Well, the personal preference for me is either a tab or 4 spaces
 
@Christian Of course it does, he's asking how much spaces should he make it...
 
@MadaraUchiha in sensible software you can customize the size of tab .. except in github , which translates tab in 8 spaces ( because Linus said so )
 
with just 1 space ... I'd say don't even bother indenting.
 
2:07 PM
@tereško Some programs can't even display the TAB character correctly, you see it as ❮ or something
 
@MadaraUchiha Stop using stupid programs.
 
some programs should not be used for programing , @MadaraUchiha
 
@Christian By "tab" I mean the TAB character, i.e. ` `
 
Well, a tab is a tab character. ascii 9.
 
Woah, another tab discussion?
God, people, just shut the fuck up and use 4 spaces
10
 
2:08 PM
Obviously, my IDE translate the TAB keystroke to N spaces (in my case 4), what I meant by not use TABs is not to use the TAB character -_-
 
(:P)
 
@NikiC well, I didn't say anythin'
 
@NikiC , as C/C++ dev you should be advocating for 8 spaces , btw
 
@tereško Whoa. Yet another reason I should steer clear of c/cpp
 
@tereško ehm, no? Nobody sane uses 8 spaces for anything in any language...
 
2:10 PM
@tereško Dark days, dark days indeed.
 
8 spaces are this big: | | That would be such a waste of space :D
 
speaking of which .. my netbook's keyboard has stated to acquire a dent on space key
 
@Gordon Well, I think it's not a bad viewpoint. It's not completely bad, it's just a different viewpoint than mine...
 
@ircmaxell fair enough
 
I'm not planning on bashing it. I think it boils down to the first assumption. He believes that Classes are Types. And if that's true, then what he said is completely valid
I don't believe classes are types. Therefore his model doesn't fit with my model...
 
2:18 PM
@ircmaxell will read your article to learn your model :) I actually dont have an opinion on the blog post at all.
 
Sounds good...
 
How can you? Like you said, $result is now an array. You can do nothing with the original PDOStatement object, as the reference to it is lost. Also, there's a very VERY wide debate over method chaining in PHP and in general, strongest arguments against, it hinders readability, and makes it difficult to understand what the final result it. In this case, the valuable PDOStatement object, is lost as well. If you wanted to, lets say, execute the query again, you wouldn't be able to do so (without creating another query, and another instance). — Madara Uchiha 18 secs ago
Can I have some back over here?
 
I like sublime text because it supports tab widths of 3, 5 and 7 spaces
 
@Leigh I like VIM and NetBeans because it supports tab widths of 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 ... 4 billion...
 
2:27 PM
@ircmaxell I might start using 4 billion space tabs. I've got too much empty space on my monitor.
 
:-D
 
Sem
@ircmaxell BTW I'm done with the Netbeans SVN plugin. To many times it said there were conflicts but was unable to find them once I wanted them resloved. Using TortoiseSVN again now.
 
use git
 
user1125394
ok so finally I take the average of answers, and use 3.5 spaces indents?
 
2:36 PM
@Sem I use command line
 
w00
or use mercurial if you like tortoise
 
user1125394
I 'd like elastic indents
 
Sem
@tereško SVN repos are already up and running, want to use GIT though.
 
@Sem Do, or do not. There is no want... :-P
 
Sem
@ircmaxell command line on Windows or Linux? And there is want for the lazy people :)
 
2:38 PM
either
 
Sem
Well I do use PuTTy for external svn ups etc. to a linux server.
 
although on Windows it's quite broken due to case-insensitive filesystems...
user image
3
 
@ircmaxell it says jQuery
 
;-)
 
disturbing
 
Sem
2:42 PM
Use $() instead of a heatsensor, who needs that.
 
@Gordon It also looks like it says twat.match
 
3 mins ago, by Gordon
disturbing
 
Hey there.
Quick question.
Is there a way to do (in sql) Type= ANYTHING ?
 
Sem
@Leigh It clearly says !val.match(), you're not made for real hardcore jQuery programming sir. Only lazy people are.
 
Like if I had "WHERE type=*" would that make it so it does not matter what "type" is?
 
2:49 PM
@JordanRichards Sure you can, just leave that out: WHERE theRestOfTheConditionGoesHere
 
@Christian ^_^ Lol, I can't because otherwise, there'd be an error with the amount of paramaters bounded.
 
Well, you can always do WHERE type=type, or if you can control the field name; WHERE 1=1, or if you can control the condition itself: WHERE 1
 
:o neat
if I set a php variable to "type" and used "type=:type" would that count as "type" the field?
Meh, no that won't work.
 
Sem
@JordanRichards Just remove the WHERE will ya.
 
No...
The WHERE is there for a reason.
 
2:51 PM
@JordanRichards By that, I guess you're messing with prepared statements? You can throw in anything in there, including:
 
I have to use the :type somewhere in the query or I'll get an error with the paramaters.
prepared statements indeed.
oh.
That'll solve my problem :)
Thanks.
 
In that case, just do this:
WHERE :type=:type
 
haha sorted.
Thanks man. :)
 
but I think a better performing way would be:
 
@Christian I believe :type=:type will fail
 
2:53 PM
WHERE yourcondition OR (1 OR :type)
 
short circuit boolean evaluation. WHERE 1=1 OR type=:type
 
hello everybody I have just started learning zencart , does anyone over here know anything about paypal integration with zencart ?
 
@MadaraUchiha how so?
If it does, in that case I'll just do WHERE 1=:type
 
@JordanRichards Prepared statements are meant for values, not field names.
 
and set $type to 1
 
2:54 PM
@MadaraUchiha No, it shouldn't fail. It should evaluate to 1=1 or true
 
@Leigh That's assuming he doesn't have anything else to check in it.
 
@MadaraUchiha yeah.
I forgot about that.
 
@JordanRichards Why do you need a WHERE 1=1?
Seems silly to me
 
@MadaraUchiha to use up the :type param.
if type is set to "any"
 
@JordanRichards If it's not needed, don't include it in the query.
 
2:55 PM
it is needed though.
 
@JordanRichards why don't you unset($params['type']) and write the query properly?
 
when binding the paramaters
 
@MadaraUchiha because 1=1 equates to true, but I prefer just 1 in such a case.
 
hello everybody I have just started learning zencart , does anyone over here know anything about paypal integration with zencart ?
 
@Samantha don't spam, we saw it the first time, and nobody want's to help you
 
2:56 PM
@Samantha Well, this is more of a PHP chatroom than a zencart one ;)
 
@Christian You're missing the point.... SELECT * FROM TABLE WHERE 1 === SELECT * FROM TABLE
 
@MadaraUchiha wut? Where did that query come from?
 
ok
 
Okay I'm confused now. I'm just looking for what works.
Will I be fine with 1=:type?
 
@JordanRichards You shouldn't.
 
2:57 PM
@MadaraUchiha ?
 
@JordanRichards Unlikely, you'd be better off not using :type at all
 
@JordanRichards No, :type will be replaced with your value.
 
Look just for what works
 
so, get rid of type from your params, and write a query without it
 
I NEED :TYPE
>_>
 
2:58 PM
No you don't
 
Because :type may be used.
I do.
 
So what if it might be used, you said you want to ignore it.
 
if :type is set to 'message' for example
then it'lll run type=:message
 
@JordanRichards if :type is useless in the context of the query, you write a query without it.
 
2:59 PM
^ it is context
I just said it was.
 
@JordanRichards Just use: WHERE (1 OR :type) AND yourcondition
 
Oh I see what you want to do
You want to write 2 queries
 
Now if these fine guys stop interrupting, I'll explain what it does.
 
@Christian lol
 
@Christian 1 OR :type will always be true, and true AND condition is always condition
 
2:59 PM
@MadaraUchiha nice :)
 
Please don't make this any more confusing than it needs to be
 
@MadaraUchiha Exactly
 
thanks
 
Explain away, doesn't change the fact that writing a variable prepared statement is completely useless. Write two queries, one that caters for the param present, and one without.
 
@MadaraUchiha Shut the f up and learn to read, ok?
 
3:00 PM
@JordanRichards When you need :type, write a query with it, when you don't, write one without it. That's as simple as that.
@Christian Excuse me?
 
@Christian We did read, he said type may be specified, and in the case that it is specified, it is relevant. If that's not the case, he needs to explain better.
 
it needs ot be ONE query
NOT two
 
No it doesn't
 
I'm gonna follow what christian said
 
@Leigh No you didn't. If you did, you'd know I wasn't addressing you.
 
3:01 PM
@JordanRichards Why? What's wrong with two queries?
 
Enjoy your terrible non functioning code then.
 
And if @MadaraUchiha did read, he'd know my code made perfect sense.
 
@Leigh It does, I don't need to explain why if Christians code works :)
I appreciate you guys trying to help though.
 
@Christian What, (1 OR :type) AND condition?
1 OR :type will evaluate to TRUE, whatever :type is, even if it's false or 0 or any
 
@MadaraUchiha that's what I want
 
3:02 PM
@MadaraUchiha He's a typical stubborn american, don't try and educate him, let him wallow in his own shortcomings
 
@Leigh who is?
lol
 
@JordanRichards How is it what you want?! Do you want to ALWAYS ignore :type? Than don't fucking use it at all!!
You people, are driving me crazy
 
@MadaraUchiha I just want to have type USED in the query
 
Why
 
i've already said why.
 
3:03 PM
you're ignoring it
 
@JordanRichards WHY THE HELL WOULD YOU WANT THAT?!
 
you haven't said why, you've come up with some nonsense
 
if type is equal to 'message', etc blah, else if type is equal to any WHAT I'M DOING HERE
 
I need to eat breakfast, but I want to use a hammer. I need the hammer to be present at the breakfast. No, it doesn't do anything, I just need it to be there.
 
There is one query, then bits are added on
 
3:05 PM
@JordanRichards IF TYPE IS EQUAL TO ANY, DON'T INCLUDE IT IN THE QUERY
 
that's why I need to use :type even if :type does not effect the query
other wise there'd be an invalid paramater number
 
@Leigh Me? I'm not American XD
 
if :type was not used int he query
 
@JordanRichards Don't use it in the query, and don't bind it either.
 
@Christian Lol, they make too many assuptions.
@MadaraUchiha I need to bind it though.
@MadaraUchiha :type isn't the only param
 
3:05 PM
Again with the need
 
@JordanRichards I started a private chatroom and explained the code to you.
 
]I also use pagination
 
what the hell is going on here ?!
 
@Christian cheers :)
@tereško debates :D
 
@tereško Experts. Loads of 'em.
 
3:06 PM
@tereško help... me...
 
@tereško General stubborn idiocy, someone who wants to do something stupid, but doesn't want to take advice on how not to do it stupid.
Only interested in continuing the stupidity
 
@Leigh ll you've said is basically "Your doing it wrong"
 
@MadaraUchiha I'm often hammered before breakfast.
 
when I do.
then when I ask why
they said you don't need "type"
 
@JordanRichards , maybe you should take it as sign , that you are doing something wrong
 
3:07 PM
Without seeing my whole code, they wouldn't understand.
 
@tereško quick question
You have a prepared query, with a parameter :type, which may or may not be used. How do you handle this kind of logic?
 
with seeing you code , they might not bother
 
@tereško I have, I'm trying to take all the advice abooard from you pros but, I can't understand your advice
@MadaraUchiha I haven't prpared it
 
@JordanRichards Without explaining, we can't understand, but when you say "I want to use this param in my query but ignore it", the obvious answer is, you don't need it in your query. That's all you explained, and that's why you're doing it wrong
 
3:08 PM
it gets prepared when the query has been built
 
@JordanRichards Correct, so build it, without the parameters you don't need.
 
@Leigh No, I said sometimes it's used, sometimes it's not, however the main query when built, in the execute, I need to bind all the paramaters.
 
It's really not that difficult.
 
@MadaraUchiha Oh..
 
@JordanRichards no you do not
 
3:09 PM
@MadaraUchiha I see what you mean now...
 
Halleluya!
 
@MadaraUchiha See, that's a MUCH clearer answer
rather than just "YOU DON'T NEED TYPE!"
 
@ircmaxell stackoverflow.com/questions/12692727/… might be suited to provide your math parser code
 
5 mins ago, by Madara Uchiha
@JordanRichards IF TYPE IS EQUAL TO ANY, DON'T INCLUDE IT IN THE QUERY
 
Which tells me nothing apart from the fact that you say I don't need it when I think I do, so it's not solving anything, and I wouldn't know what to do
 
3:10 PM
How was that not clear enough?
 
There are too many full size avatars in this room
 
@MadaraUchiha Because I didn't understand the logic of it.
ANYWAY, enough complaining.
 
...there. Much better
 
Thanks for your great help :) I'm not the best one at understanding things. It's probably me, not you.
 
@MadaraUchiha , depends , i would most likely make some query-builder script , to generate it ... then again , i cannot recall , what was the default behavior for .. WHERE foo = NULL ... i just remember that it did not work as expected
 
3:12 PM
Cheers guys
 
@tereško WHERE foo = NULL >> false
Even WHERE NULL = NULL is false
(you need IS_NULL())
 
@MadaraUchiha haha, that's odd.
 
@MadaraUchiha then generator it is
 
Righto guys I better get back to work, thanks again for your superb help.
 
@tereško My suggestion looked like: WHERE (1 OR :type) AND RestOfTheCondition
 
3:15 PM
way too convoluted
 
@Christian That always ignores type, he just said in some cases he wants to detect if type is equal to something
 
@Leigh Uhm....that's why there's RestOfCondition
 
Here: (1 OR :type) AND :type=somecase, happy now?
 
@Christian Now read that again, and work out how silly you've been.
 
3:17 PM
@Christian Thanks for your help, but @MadaraUchiha's suggestion of only binding it if type!='any', I think is much neater.
 
@JordanRichards ok sure.
@Leigh Why?
 
@Christian I see your logic though, I appreciate you trying to help anyway :)
I'm off
Cya.
 
@Christian Well, aside from the fact you've switched your OR to an AND, why would you check :type like that AND compare it to something specific?
 
@Leigh Yeah, sorry. Kept pasting the wrong thing.
@Leigh Well, he should be deciding that.
I just explained how one can throw in a parameter without impacting performance.
 
@Leigh ^_^ there would never BE :type=blah AND :type = blah because the query is constructed with what @Christian said ONYL if type does not matter, therefore what christian said makes perfect sense. But I will use @MadaraUchiha's suggestion still, but please. @Leigh Quit moaning? :)
 
3:19 PM
@Leigh if ($var && $var == true && $var != false)
 
If at the end of the day he still needs to check that parameter, well, that's not my problem is it?
 
@DaveRandom that would never occur in my script.. have you not been listening? xD
@Christian I will never need to 'still' check the param lol
Anyway end of argument guys. It's sorted.
 
@JordanRichards No, it doesn't make perfect sense. But go ahead and do that. It'll give whoever picks up your code at a later date some chuckles.
 
@Leigh I'm not gonna go ahead and do that. (again, you're not listening). What @Christian did made perfect sense. (1 OR :type) would only be in the query when $type=='any', therefore, :type would not be used after that in the query.
 
6 mins ago, by Christian
Here: (1 OR :type) AND :type=somecase, happy now?
 
3:23 PM
@Leigh 'AND :type=somecase' would never occur
 
@JordanRichards Go sign up, coursera.org/course/intrologic
 
as I said........................... -_________-
@Leigh Nah it's okay.
 
Even as a passive member of this weird conversation my brain is starting to hurt. It is in every possible sense of the term, illogical.
 
@DaveRandom I think me saying that I'm using what @MadaraUchiha's idea has just gone out the window.
 
@DaveRandom You know, we should just quietly watch and smile, and not get involved, knowing that if this small proportion of people are representative of the whole, we are irreplaceable in our jobs.
 
3:26 PM
Nobody's seem to notice that I don't think @Christian is the perfect one, it makes PERFECT sense, but not the perfect answer.
I'm not agreeing with @Christian, I'm just saying I know why he's said it and can see where he's coming from :)
An error is thrown if I bind 'type' when 'type' does not exist in the query.
 
@JordanRichards Which is why we said at the start, don't include it in your query.
 
So @Christian was just showing me how I can use :type in the query, without type actually doing anything, this stopping the error.
@Leigh I was not sure HOW I could just "NOT INCLUDE IT IN THE QUERY". But thankfully @MadaraUchiha pointed that out nice and clear :)
 
@Leigh Amen to that.
 
@JordanRichards That's like saying, you don't know HOW to use if
 
@Leigh No it's not.
if is SYNTAX. What you were saying is a WAY of doing something.
 
That's like saying "YOU DON'T KNOW HOW TO USE ORDER if you don't know how to dynamically order something depending on user's input"
Point proven.
Anyhow I'm sick of arguing here about something that's already solved.
 
Bye then
 
At the end of the day you guys have solved my problem.
So thanks so much for your help :)
Bye guys.
(personally I think I'm doing pretty well for 14 years old when it comes to logic)
 
0
A: How to make a calculator in PHP?

ircmaxellDepending on your needs, I would suggest looking into the Shunting Yard Algorithm. It's pretty easy to implement, and works quite well. Here's an example I whipped up a while ago: GIST. Here's the code copy/pasted into one block: Expression Definitions: class Parenthesis extends TerminalExpre...

 
@ircmaxell Awesome answer!
+1'd
 
3:36 PM
@ircmaxell That GIST link is showing up as already clicked ;) - The code you revisit every so often to do-over?
 
@Leigh :-D
@Leigh No, haven't touched that one in a while...
 
Ok, I was pretty sure the link cropped up during that conversation
But unimportant really.
 
Oh, yes
I wasn't sure what you meant by that
yeah, I tend to rewrite that from time to time. That and BF interpreters
 
Best PHP calculator I know eval('return ' . $math . ';');:P
 
3:45 PM
lol
you forgot to pull it from GET: eval('return ' . $_GET['math'] . ';');
 
@NikiC until someone sets the input such that $math = 'eval($math)';
 
@ircmaxell No it's OK, he's assuming register_globals
 
Ah, yes, that's true
 
3:57 PM
@NickiC Did you ever read about "nanopass compilers?" (gradworks.umi.com/3337263.pdf) I know you're somewhat interested in compiler-related stuff :P
 
Hi I wonder the best way to validate values from a form. To avoid error in a database. I am using javascript to avoid from the client side. But from the server should I use is_int, is_float, reg_exp, etc. Or there is a nice frame to use??
 
@andres83 php.net/filter ?
 
@Leigh Thanks Leigh it is very useful
If you have a form that allow to edit data of a table and create new data of that same table. Would you use the same action property, or you would send to different pages.
 
@Leigh very interesting
 
4:57 PM
how can i get a list of all users using an application on facebook?
 
5:18 PM
@chepe263 court order would do it , i guess
 
????? court what?
 
A court order (a type of court ruling) is an official proclamation by a judge (or panel of judges) that defines the legal relationships between the parties to a hearing, a trial, an appeal or other court proceedings. Such ruling requires or authorizes the carrying out of certain steps by one or more parties to a case. A court order must be signed by a judge; some jurisdiction may require it to be notarized. The content and provisions of a court order depend on the type of proceeding, the phase of the proceedings in which they are issued, and the procedural and evidentiary rules that gover...
 
igual no entiendo bien
 
user1125394
@chepe263 developers.facebook.com good luck their doc is cheap
 
@cyril , i am quite sure , that it is not possible to do via public API. It would be an extreme violation of privacy, which in some places could lead to people dying or being prosecuted
 
5:24 PM
 
jQuery docs are the best documentation i had find so far
 
user1125394
@tereško he probably meant using his own app
 
That album's from 1971. Mind the "Home Taping kills Music" :D
 
@tereško i guess i needed an external db to store user_id to get the information i need
 
user1125394
@chepe263 your app or any app?
 
5:26 PM
it is my app
 
this is probably a stupid question, but lets say you have an object that relates to a row of a table in mysql. it makes more sense to retrieve the row from the db and pass that to the constructor, rather than pass the id of the row to the constructor and then do the db query within the object, correct?
 
@DaveRandom downloading
morning people
 
mornin @PeeHaa
 
@AndyPerlitch i will just point you here : stackoverflow.com/a/11943107/727208
because i am a lazy , and i am whoring for 20k
 
@tereško thanks man!
...not quite sure what whoring for 20k means
 
@PeeHaa ah i gotcha
i just sorta gave up on reputation... any question i could answer even somewhat helpfully is immediately answered by someone more knowledgeable, and any question i have is either already answered or a terrible question
 
hi , how much is the ideal length of username ? i made 20 is it good ?
 
user1125394
for password it's a good length
 
for username?
 
under 128
 
user1125394
5:53 PM
username if it's emails, they are > 20
 
there is nothing stopping you from using your email as username
 
i made 20 but i think its much , so im thinking to make it 15 .
 
user1125394
it's bad but many do that no?
 
@AndyPerlitch You've already given up on reputation? Go out there and answer them dang questions!
@goodmood Your username's length doesn't really matter.
Especially on sites where your username is exposed to anyone (yes they still exist)
 
gggggggggggggggggggg
this is 20 g :) i think no one use like that length :)
 
5:56 PM
@goodmood 42
@goodmood What a stupid idea to limit the username.
 
madara uchiha its 13 length
 
@goodmood "Stupid idea" is only 11
 
user1596138
I have a php script that I submit a form to and it emails me all my preconfigured variables. How could I have it just automatically create a variable for each field on the form?
 
@PeeHaa , it kidna depends. If you are using username for authentication, then you will be selecting by it, and there is limit to how long text can be indexed , without resorting to "fulltext" indexes
 
Unless you also want to prevent users from using a space which would make it 10
 
user1596138
5:59 PM
I have a few more forms to do and It occurs to me that I don't need 6 or so scripts, just one that will take the info and make a variable using each <input> and <textarea> on my forms.
 

« first day (717 days earlier)      last day (4228 days later) »