« first day (656 days earlier)      last day (4305 days later) » 

8:10 PM
that sucks
 
@Lusitanian We need a truthminister, right now!
 
Five million people in Silicon Valley walk into a bar. No one buys anything. Bar is declared a roaring success and files for IPO.
 
hi
I need some help with strspn function. I've search but couldn't find anything about this. Does this function only looks for the first word of a string? I mean does it return when it meets a space? here is my codes:
 
8:29 PM
@draconis Depends on the mask
 
lol wth it worked
i just tried again before post code here
and i notice it is working
@PeeHaa now it is not working again, i think i'm missing something please take a look, second pasting code.
example is from manual:
var_dump(strspn("42 is the answer to the 128th question.", "1234567890"));
this one is working
but this one does not:
var_dump(strspn("is 42 the answer to the 128th question.", "1234567890"));
 
@draconis Define not working?
 
it returns 0
instead of 2
 
Why should it return 2? is doesn't match the mask
 
@ircmaxell haha - FB is probably going to be under $20 tomorrow
 
8:36 PM
@PeeHaa doesn't it match 42? cause it returns 2 at the first example
 
@draconis It only matches the characters from the start of the string based on the mask
 
@draconis it's likely not what you need
 
What are you trying to do @draconis
 
@PeeHaa Actually nothing, just trying functions that i never used to learn
 
@MikeB it's so screwed
 
8:37 PM
so it's mask doesnt work like trim?
 
@draconis The mask contains the characters you want it to match
It counts the number of characters matching the mask from the beginning of the string (until it hits characters which aren't in the mask)
var_dump(strspn("127837326 is 42 the answer to the 128th question.", "1234567890")); // outputs 9
 
ah got it.
 
someone help me with naming namespaces
OAuth\OAuth1, OAuth\OAuth2, OAuth\Common or
OAuth2\, OAuthCommon\, OAuth1\
 
@PeeHaa i thought it works like strstr but with a mask instead of a string. Thanks for making clear.
 
@draconis np
@Lusitanian 1
I think :P
 
8:42 PM
you mean the first option?
 
yup
 
Are there lots of common stuff in v1 and v2 of oauth?
Or is it totally different and is it only for "external" stuff?
 
well, here's what will be common:
the TokenStorageInterface
the ServiceInterface
(I want to login to instagram/google/whatever with the same api)
and maybe the tokeninterface -- but there's no refresh token in oauth1
 
@Lusitanian yup it should easy to add services
@Lusitanian nope
v1 tokens "never" expire
 
8:45 PM
which is bizarre and makes no sense
because services implement that differently
tbh oauth is such a clusterfuck
 
we shouldn't need 12 classes for different services implementing one protocol
 
@Lusitanian hehe I noticed
 
@PeeHaa Did @Neal's cv-pls autobox for you?
 
mine didn't :(
 
8:50 PM
@Truth Nopez. @Neal used the proprietary cv request format with a colon
 
@PeeHaa there's going to be a base "BaseTokenInterface" and a "TokenInterface" under oauth1 and oauth2
that way tokens can be passed around agnostic to protocol easily
 
@Neal: While it is correct, you aren't explaining anything. Why can't it be done? What are the alternatives? The question is correct but is not useful. — Truth 12 secs ago
 
@Truth oyyyy
 
@Neal Sorry mate. That's my opinion.
It's like I'd come to people and say "Don't use mysql_*" without giving context or alternatives.
That's not very good education now is it?
 
why the fruit downvote it?
It is a correct answer!
 
8:54 PM
@Neal Correct != useful.
 
it's correct but honestly I agree with @Truth
 
And I'm not the only one that things so, so far you've gotten 3
 
when someone comes in with the same problem that's useless
and you still should expand more (i'm just being a whiny nitpicky ****, so you can ignore me :P)
 
@Neal isn't the point to upload without a page refresh?
Now you got my vote :)
 
@Truth you cant without an ifame
 
8:58 PM
chick-fil-a sold so many sandwiches yesterday...evidently america is more anti-gay than we thought
 
I added that to the answer...
 
@neal undownvoted and upvoted
 
@Lusitanian thank you...
 
lol
is "Null" with a capital N a legal name for a php class?
 
seems to be: php -r 'class Null {}'
You better replant that tree
 
9:07 PM
Valid AVL tree?
    //            2
    //         /     \
    //      -2        5
    //      / \     /   \
    //    -6  -1   4     8
    //    / \     /     / \
    //  -7  -5   3     6  10
    //                  \
    //                  7
 
Asking me to validate an AVL tree is like asking me to play professional football...
 
@Lusitanian not that i know of. null is a primitive type, and types are case agnostic
 
@webarto OMG ;o
Is that phpDesigner?
 
Unless there is some concept I've forgotten it is a valid AVL tree, but it seems wrong.
 
9:10 PM
@cHao works fine: codepad.viper-7.com/YdpgrR
 
@Truth yes it is, first IDE I used long time ago (well few years)... kind of used to it? Works for me... Notepad++ is always opened besides...
 
phpstorm > all
 
@webarto I used to use it, but ditched it for PhpStorm
@Lusitanian Word.
 
@Lusitanian ok, that's messed up.
 
9:11 PM
yeah that really doesn't make sense
 
@Truth is this $99 lifetime license or per version?
 
@Truth closed for ya
@webarto version + 1 year updates
 
@webarto I have the educational
 
it's $96.02 at componentsource
 
But I'm considering to purchase the personal license
 
9:12 PM
@webarto :D
 
@Truth there's an educational version? Shit...how didn't I se ethat
 
@Lusitanian It's for teachers/students
 
i count as a student but not a teacher
 
@Lusitanian thanks ;) @Truth I see now
I have Zend Studio, opened it and it and looked for X hehe
 
I had to perform loops up in the air to get it too :D
 
9:13 PM
xD
I have access to MS software if anyone needs something, but you also probably have...
 
i have access to it through my acm membership
 
@cHao In my understanding the concept of NULL in PHP is wrong
 
kinda useless since my only desktop os is linux
 
IMHO, Null should be a null-pointer-object
 
makes sense @Lusitanian
 
9:15 PM
but i like acm for their digital library and whatnot -- very useful
 
One that can be passed as an argument to any type of parameter (primitive or not), without being afraid of type-hinting problems.
 
root@debian:/var/www/helpdesk# chmod -R 0777 /
f*
 
And no, using default values is like using the PHP hammer.
 
@Truth but will it work in codeigniter?
class NullPointerController extends CI_CONTROLLERRAWRAIJVOWE
 
@Lusitanian But will it blend?
 
9:17 PM
i always ask people that and no one ever gets the reference -_-
there's something liberating about seeing an iphone get torn to pieces
 
doctrine 1.2 makes me sad
 
@webarto Pasting the code will get you better results.
:4778122 ?
 
@truth what more information can I provide for you?
 
@Truth nah, just demonstrating 1200 lines of no braces and lots of chaining :) PeeHaa told me to always use braces, I didn't for one liners...
 
9:21 PM
@CraigWilson The question you asked was highly subjective.
It's really a matter of personal preferences. I tend to always use PDO::FETCH_ASSOC, and I usually stick with fetchAll, but people here might tell you otherwise.
 
@truth I have added my application requirements as suggested, if you would be kind enough to take another look?
 
It's really about what you prefer, and what you're comfortable with
@CraigWilson In the specific case you've posted, I'd go with fetchAll and PDO::FETCH_ASSOC
 
I'd be comfortable with anything that I can get working!
 
Since you need a readable array, and you don't need to do anything with it while fetching the results, only after.
But as someone said in your comments
Hint: you're focusing your energy in the wrong place. — Palladium 34 mins ago
Just pick one and start working! It doesn't really matters, stick with the one you find easiest to work with and go!
 
speed of sound > all other coldplay songs
 
9:23 PM
Evening everyone :D
 
morning ;D
 
Haha
Is it possible to assign UNIQUE to a TEXT field in MYSQL?
 
@Mittchel Any reason why not?
(yes it's possible)
 
@Truth because I'm getting an error for some reason.
 
@Mittchel Which?
 
9:26 PM
#1170 - BLOB/TEXT column 'url' used in key specification without a key length
 
@truth I've spent the most part of today on it, so i'll create a new question with my current setup, and could you perhaps offer some advice as to why it's not working?
 
@CraigWilson If you have a specific question, I'll be happy to look at it.
 
Not possible on TEXT haha
 
@truth Ok, thanks again.
 
@Mittchel Any specific reason you're not using VARCHAR?
 
9:29 PM
I am trying to save favorites to one table and getting them back by saving their id. So in one table I have name and id and in the other the text and id. So I tell it this $query = "SELECT Beitrag,satzid FROM $table_id INNER JOIN $table_id2 ON Favoriten.Favoriten = Forever.satzid WHERE Favoriten.Name = $name"; But it doesn't work. I am guessing its because I am doing something wrong (not that well acquainted with php yet). Someone spotting my mistake?
 
Well the field is an auto generated url, VARCHAR minimizes me to 255 chars. So basically I don't need a TEXT you're right lol :D
@Truth other question; have you used a lot of different frameworks?
 
@Mittchel I have never used a framework in production code
I used CI once to get the feel of it, and left it almost immediately
 
@Truth ohh that's a shame.
 
I'm looking for a new one to test ATM
 
Yep I'm using CI right now, but it's not really what I want though.
So thought maybe you had some suggestions.. I heard about Symfony2
 
9:31 PM
just don't use Doctrine even if your life depends on that
 
@Mittchel VARCHAR has a hard limit of 65K (65535 characters)
I don't think that's an issue here.
 
Indeed
But as what do I create the field then? VARCHAR(65535) or just VARCHAR()
 
Also, UNIQUE can work on VARCHAR I have a table on my local environment to prove that...
@Mittchel If you know the max length, than use VARCHAR(MAX_LENGTH_HERE)
For instance, if you know that the special key for the auto-generated url will never exceed 50 characters, 50 characters is your limit
 
@Truth: Varchar(8000) stores a maximum of 8000 characters. Varchar(max) stores a maximum of 2 147 483 647 characters.
 
If you're not sure, you can always use something ridiculous like 1000, but prepare to suffer from index inefficiency.
 
9:33 PM
@Truth: I'm not sure how much it would be. The user is able to input the url themself.
 
@webarto doctrine2 is fine ok tolerable
 
@Mittchel Enforce a limit upon the user.
 
@Truth: Newbie question; what's index inefficiency? What's the downside on it?
100 chars is nice limit I think.
 
There's no reason in the world why a user would need over 100 characters for a URL.
@Mittchel Indexing is a method which databases use in order to retrieve data efficiently
 
So you think that's a great limit, or still too large?
 
9:35 PM
The correct use of an index can speed up your SELECT queries like magic
 
too large...
 
However, if you're expecting 50k characters, while you only store 20 each time, that index will be inefficient.
There are great questions about indexes here on Stack Overflow, all you have to do is search.
Well fellas
I'm off to bed
 
Thanks mate.
Have a great night. Sleep tight.
 
@Lusitanian I'll probably move (fall behind) to ZF2 and Doctrine2 in a year... do you know of any other simple as possible ORM?
 
;)
 
9:36 PM
gn
 
@webarto not using an orm comes to mind (;
just use mongodb, what data do you have that's relational
 
i wonder if there's a jquery db yet.
 
how do i mysql with jquery
 
@Lusitanian others use it, I'm for writing SQL... you only have to do it once to get the power of "ORM"...
    $q = Doctrine_Query::create()
    ->select('COUNT(*) count')
    ->from('Notifications n')
    ->where('n.accessed_at IS NULL')
    ->andWhere('n.staff_id = ?', $this->currentUser->id)
    ->fetchOne();
    # set count in view
    $this->view->notificationsCount = $q->count;
 
who am i kidding. of course there is.
 
9:39 PM
this s* produces so much data that it can't fit on kilometer of screen... just for count... because of relations...
 
mother of god...
 
@webarto which it gets automatically. use
mongo
 
I can't think that sane person would use that DB plugins... (not mongodb)
I had too much jQuery today :)
 
jquery does everything now.
too much jquery?!
BLASPHEMER!
 
9:43 PM
jquery is god
 
one advantage over CSS :P $('.bubble:contains("0")').hide();
but it doesn't work anymore xD
 
@Mittchel There is a limit of the URL length by (most?) user-agents
 
@PeeHaa yes i'm repeatedly bothering you because i'm terrible with names
should i call the standard oauth2 token stdoauth2token
or oauth2token
 
@PeeHaa hmm nice to know :) thanks!
@PeeHaa Do you have any experiences with frameworks?
 
524
Q: What is the maximum length of a URL?

Sander VersluysDoes it differ between browsers? Does the HTTP protocol dictate it?

 
9:49 PM
do bad experiences count?
 
@Mittchel I (have to) use Zend FW at the office, but generally speaking you wouldn't find anyone happily using frameworks here in chat
@Lusitanian hmm
 
@PeeHaa Hmm.. why's that? People build their own framework?
 
@Mittchel because 99% of frameworks are garbage and the ones that aren't still aren't great
If you're going to use one, use symfony2
@PeeHaa, see, naming is tough!! ):
 
@Lusitanian Yep I was looking at that one. I'm still a bit of a newbie in PHP, but I really like the use of a framework. I would like to create my own CMS (yep again a CMS), just for learning purposes.
I used CI, but the feeling isn't that great for me.. @Lusitanian is it possible to use a domain model / design patterns with Symfony2?
 
@Lusitanian Go with the std prefix until I change my mind :)
 
9:52 PM
@Mittchel CI is a large turd in software form
 
haha
 
Yes, it is; however; it's hard to strictly implement beautiful design patterns in any framework
Symfony will let you follow the observer pattern
with its eventdispatcher component
for ex. @PeeHaa okay
 
@Lusitanian Could you explain me in global what that eventdispatcher component does?
 
??
OH, the credentials
does oauth1 use the same format
client id/secret/callback
 
@Lusitanian consumerkey, consumersecret and callback yup
 
9:55 PM
at least they kept something consistent
 
@Lusitanian however
 
i was waiting for the gotcha
 
hehe. Just wanted to freak you out :)
 
DAMN IT
 
:P
 
9:56 PM
i stopped coding while waiting for your response lol
 
user895378
@Lusitanian Technically, the symfony dispatcher is a mediator pattern implementation and not the observer pattern :)
 
:)
 
@Lusitanian it's hard to strictly implement beautiful design patterns anyway. either they're built-in features of the language, or they're a workaround for the lack thereof.
 
@cHao fair enough
but symfony doesnt make it any easier
"EventDispatcher implements a lightweight version of the Observer design pattern."
 
user895378
@Lusitanian Yes, the symfony documentation apparently can't make the distinction either.
 
9:57 PM
that's, of course, having used it sparingly and with myself not being fully clear on the differences
@rdlowrey can you suggest a good book on design patterns? i'd be quite interested
if there's one you particularly like
 
the canonical one is actually called "design patterns" (with some subtitle i've long forgotten)
"elements of reusable object-oriented software" or something like that
 
user895378
Yes, there's the original GoF design patterns book, but IMHO Patterns of Enterprise Application Architecture by Martin Fowler is much more useful.
 
by gang of four, i know
 
@rdlowrey that
 
user895378
Those are the only two "design patterns" books I've ever read.
 
9:59 PM
i have to go out later, maybe i'll stop at the bookstore on the way back
of course the odds of my local barnes and noble carrying a copy is slim to none
 
i read the head first one...it wasn't too bad
 
user895378
I don't know, PoEAA is pretty ubiquitous
 
but i've forgotten half of it...lol
which isn't a big deal...hardly anybody uses more than half the patterns in any of those books anyway
 
hmm...the ebook version is $30
@cHao indeed but it's still quite interesting
 
user895378
Yeah, the only patterns that really stick are the ones I use regularly. The rest I just have a vague idea about and reference the books or online literature when I feel like there's something that would be useful but I don't know which one.
 
10:01 PM
what do you use regularly? (obviously mediator)
 
overflow.com
 
user895378
Singleton! All of the things!
 
lol
 
singleton!
 
user895378
10:02 PM
wooooh!
 
lol
as if.
 
admittedly that was one of my first forays into "OO"P
i was young and innocent...and it did things to me ):
 
user895378
I think it's everyone's. I lost my pattern virginity to Singleton.
 
@Lusitanian i think it's everybody's.
 
user895378
But DataMapper/Gateway is mandatory if you don't approve of ORM like me.
 
10:03 PM
lol. do either of you have formal (i.e. college) training in comp sci?
just trying to get an actual gauge, somewhat interested
 
user895378
@Lusitanian not me.
 
it's, like, those globals we were taught were so wrong...in a nice shiny GoF-blessed object wrapper.
self taught
 
interesting...that seems to be the case with many here
 
user895378
Well, leave it to the people who were interested enough to teach themselves to hang out and talk about the subject matter they chose to spend all their time with :)
 
lol
what he said :)
 
10:05 PM
good point :)
 
user895378
If you're looking for books though, my recommendations are PoEAA, Code Complete 2nd Edition (which I only finished recently) and Clean Code
 
@Lusitanian I did sysadmin stuff at school. Didn't took me long to realize that wasn't something for me
 
@PeeHaa this is actually starting to look like a well-structureoauth lib!
i hate sysadmin crap
 
user895378
@Lusitanian +1
 
few months ago
 
10:07 PM
posted on August 02, 2012 by blog.phpdeveloper.org » PHP

Recently I’ve become more interested in something that, despite the wealth of resources out there, still seems to be lacking in a lot of web-based applications – good security. I’m not talking just about the “filter input, escape output” kinds of things. I’m digging a little deeper than that and looking and encryption, hashing, authentication methods and network/server configurations that could

 
@Lusitanian nice :)
@Feeds stfu
 
user895378
@Feeds Oh no! Et tu Brute?!?!?!
 
man, windows is persistent. i keep telling it no, restart later....and it just tried to up and restart on me now
 
@cHao you can disable that in the registry
 
like, didn't even ask.
 
user895378
10:08 PM
You know what shield isn't? An architecturally-minded framework.
 
user895378
Closures! All of the things!
 
Try half-assed functional programming, they said. It'll be clean, they said.
 
lol
 
user895378
Maybe it'll prevent you from getting hacked, but it's still function without form.
 
functional programming is an interesting paradigm but i feel as though if i were to write an application that way it would turn into spaghetti code within minutes
 
10:10 PM
fun part is, pure functional programming is all but useless. you have to resort to some semantic hack like "monads" in order to make anything happen
i'd be happy with half functional, half oo, half imperative.
oh, hi, js!
 
user895378
@Lusitanian I just real quickly want to revisit this:
 
user895378
> The Symfony2 Event Dispatcher component implements the Observer pattern in a simple and effective way
 
user895378
@Lusitanian You are officially absolved of guilt.
 
user895378
Just because a listener observes an event doesn't mean you're using the Observer pattern, kids.
 
What's the SF2 Event Dispatcher missing?
 
user895378
10:13 PM
It thinks it's an Observer implementation, but it's actually a Mediator.
 
user895378
Or pub-sub, but definitely not an Observer.
 
ok...headed home
 
chao @cHao
 
user895378
later
 
@rdlowrey i was afk...what do you mean --
oh, nevermind
 
10:17 PM
Anyone familiar with mootools selectors?
 
user895378
It's all semantics anyway, but I like to point out when frameworks say/do dumb stuff :)
 
i've noticed
@PeeHaa yet another question...are scopes existent in oauth1
 
user895378
And hopefully if people observe me doing dumb stuff they'll point that out. Otherwise, it's like eating dinner with someone and not telling them they have food on their cheek.
 
nevermind yes
@rdlowrey that's a reasonable analogy except i often times forget to do that :S
 
@rdlowrey here here
 
user895378
10:19 PM
@Lusitanian Well, sometimes you feel bad for them and you don't want to cause any more embarrassment for the person
 
user895378
But programming should be a pro-embarrassment environment. If you're doing something wrong, it's best to find out as soon as possible so you can correct it.
 
user895378
Which is why this room is great ...
 
most certainly
 
I dislike it whenever I have a lot of tests that fail, I make a few changes, rerun the tests and get the green light. I know that means I have to write more tests.
 
Well.. that's not always true. But I know what you mean
 
10:22 PM
@MikeB For me, it's almost always true :/
 
What would you expect? 1 change === 1 failure?
 
If I have a green light, it means there is some test case I didn't think of.
 
user895378
@LeviMorrison I usually only get that from an api change like a method name or something.
 
user895378
@LeviMorrison Also, I'm in favor of wiki.php.net/rfc/… ... I'm a little surprised there's not a suggestion of default implementations for interfaces :)
 
That can be included in PHP 6.1
lol
I still have to answer "How do you propose to type-hint scalars?"
 
10:30 PM
gotta go
@PeeHaa pushed my untested changes
so whenever you have time gogogo
 
@rdlowrey By the way, we don't have to rewrite the engine to type-hint class properties, but we would have to change it for variables outside of classes
If you can type-hint scalars, then you can type-hint class variables because all those do are define methods that have the proper type-hints for that type. The automatically created variable can be a standard PHP variable.
This might cause WTF? statements to fire off, but at least it could be implemented without changing the system (beyond adding the ability to use scalar type-hints).
And calling a function when you use $this->property.
 
user895378
Right. I'm personally in favor of someone else rewriting the engine so it's pristine and malleable for PHP6. Yep, count me in for someone else doing that :)
 
What about the sets/gets proposed in php5.5?
public $hours {
    get { return $this->seconds / 3600; }
    set { $this->seconds = $value * 3600; }
}
there we go
 

« first day (656 days earlier)      last day (4305 days later) »