« first day (714 days earlier)      last day (4460 days later) » 

user1125394
00:00
@DaveRandom where is vanilla is this list en.wikipedia.org/wiki/List_of_JavaScript_libraries? can't find it
4
@I'll-Be-Back It should be noted that I would not criticise (in fact, quite the opposite) you for using PRG, it is IMO how every single POST request from a browser should be handled.
@cyril Dude, seriously, read that page really carefully. Try downloading it and look at the source file it gives you. There is a hidden message.
btw .. on completely unrelated subject , @I'll-Be-Back , what was your reaction regarding that "muslim movie" ... i kinda like this opinion : i.imgur.com/k6qZk.jpg
and which is the CodeReview post that you were talking about
user1125394
@DaveRandom ok I go to bed sry
@tereško Well I disagree what the muslim have done.. They should have protested peacefully. But you have to understand they love Prophet Muhammad (PBUH) deeply.
@tereško I have posted on codereview yet
<- atheist
00:05
@tereško I recommend you watch this youtube.com/watch?v=I6zuKbBlmRo
Recent video, only 5 minutes..
typo - I havent* posted on code review yet.
@I'll-Be-Back Are you a Muslim, by the way? One doesn't like to make assumptions, but I admit you sort of got mentally filed as one in an earlier conversation, even though that is completely unjustified.
huh ?
@DaveRandom "you sort of got mentally filed as one in an earlier conversation" ??
What are you referring to
Yes I am muslim.
maybe Dave is psychic =P
@I'll-Be-Back Yeh when we were talking about your "family member" (I think was the term you used) who's a midwife, and I think you mentioned she was Pakistani, so I then sort of filed you as a Pakistani as well even though it could just be a non-blood relative you were talking about, and I'm not proud to admit that until I actually applied some thought to it that sort of just automatically made you Muslim as well, even though I am well aware that Pakistan is just as religiously diverse as the UK
00:12
and , btw , i think that all of the religions need a serious update .. they just had not kept up with the world
but that's just my opinion
@tereško Catholicism FTW where that is concerned IMO
@DaveRandom Oh yes, but I havent said anything wrong or rude?
@DaveRandom lol ... they forbid marriage and then are shocked when all those molestation cases come up
@tereško That's a very trimmed down version of my opinion on religion :)
@I'll-Be-Back Oh no absolutely not. And the problem is mine, not yours, I stereotyped you as a Muslim on no real grounds. /me feels like I'm digging a deeper and deeper hole for myself
00:15
@PeeHaa , my full opinion would require few pages
:-)
@DaveRandom , you're british .. we understand .. it's like a medical condition
@DaveRandom Cool =)
@tereško did you watch the video?
the one you linked , yes .. it was ok
but i would apply the "just grow the f*ck up" message to all the religion and religious texts
@tereško Technically @I'll-Be-Back is British as well, in fact he's only about 20km away from me, that's what makes it even worse
00:18
Why would that make even worse? :P
Life was so much easier when we dealt with all the "bloody foreigners" by assimilating them into an empire. :-P
@I'll-Be-Back I don't know, I just feel quite guilty about racial/cultural stereotyping, I sort of pride myself on not doing it, so when it happens accidentally, as it were, it makes me feel bad :-(
Aslong you not a member of EDL or BNP - then its all good lol
:P
@DaveRandom that's what we call "fighting against mental conditioning"
00:22
@DaveRandom dont worry, chill mate
@I'll-Be-Back The last council elections here the BNP were well on it trying to get in, they got the sh*t beaten out of them in the polls, and were the source of one of the best things I've ever heard: they were driving around in a van with a loud hailer and they got properly ambushed on a council estate and had bricks thrown at them by - and this is the best bit - a bunch of people in KKK outfits that were black instead of white.
I actually lol'd when I read that
Hmmmmm
Crazy
@I'll-Be-Back What's going on with this code review then?
I am still coding lol, trying to finish 1 more class
Also, no offence, but that PDO class is awful and pointless for so many reasons I don't even know where to begin
00:31
agreed
@DaveRandom Which Question?
I will say this: PDO is already OO, if you want add some sugar methods (which personally I feel is probably unnecessary, but I don't know everything) then you should extend it, not decorate it
3
Q: How to improve Try...Catch Block for PDO?

I'll-Be-BackI have written a PDO wrapper and a class file like a model. So far, it's looking so good! I am just confuse where I should put Try...Catch block - Would it be better to place in PDO wrapper (pdoDatabase.php), mobile.php (model) or test.php? See the code below, pdoDatabase.php class pdoDatabas...

Ohhhhhh Yes.
Posted this 3 days ago
No decent answer :/
Feedback always welcome =)
@I'll-Be-Back See in a way the problem is that you asked the wrong question. The issue is not "How to improve Try...Catch Block" but "how to add whatever functionality it is you want out of that class to PDO". The answer there does make some very good points though.
Yea and he said he will come back for more details.. so I am waiting lol.
00:38
Can you explain, in English not code, what you want to achieve with that class that PDO does not do by itself?
No, I am just created helper functions
@I'll-Be-Back , IMHO, it is better just to inject the PDO instance in object that need it , without extending it. Kinda like here : stackoverflow.com/a/11369679/727208
Right OK, well there's not necessarily anything wrong with that, but you should do it by extending PDO and/or PDOStatement rather than wrapping it
@DaveRandom Example what you meant?
I thought fetchData() function is pretty good.
OK, at the very simplest level, in the constructor you enable exception error mode instead of the default, you could do something like this:
00:43
Almost every website tells that mysql_real_escape_string is not needed in PDO. Is it true?
class myPDO extends PDO {
  public function __construct($dsn, $user, $pass) {
    parent::__construct($dsn, $user, $pass);
    $this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    $this->setAttribute(PDO::ATTR_EMULATE_PREPARES, FALSE); // always set me for MySQL!
  }
}
@user1079641 mysql_real_escape_string() has nothing whatsoever to do with PDO.
@tereško What's that PDO beginners link you always give out?
That's the badger
@user1079641 ^^ that
read that
and come back when you have read and understood every word of it
I think people directed him to that link a couple of times by now
you understand the question...one min
00:48
someone is talking to the little people again ... it's confusing
@DaveRandom I see!
Good idea
@user whatever. Read the fucking tutorial
...aaaaaannd it's gone!
Although I sort of wish there was a timer you could impose on it, I kind of feel a bit unfair sometimes.
@DaveRandom That particular user should just be banned from chat entirely
00:54
The other thing that really p***es me off about it is that it totally screws up the avatar list in the top right. I was flicking through the issues before and noticed that's on the to-do for cv-pls, will look at that after the current round of stuff is dealt with
@Jocelyn Are you trolling the tag again?
yes!
0
Q: Validation Class - Feedback Welcome!

I'll-Be-BackI have written a Validation and Form class in PHP. Validation class allow you to define the rules of each field and a error message. Form class allow you to get a error message and also allow you to get a value of POST via $_SESSION. I stored in $_SESSION because if validation did not pass i...

There ya go.
:)
I don't have an account there
01:05
i think that the whole concept is wrong , and validation should be done within the domain object
that said .. shouldn't the validation rules be applied to the form, not the validator ?
Yea that could work
@PeeHaa Perhaps you try to understand what I am saying instead of just simply see that a message came from my account and mock me away.
As for my question, here is an example of what I was asking: sitepoint.com/forums/…
i mean , you can have multiple forms , checked by same validator
01:09
Does PDO have a method similar to mysql_real_escape_string ?
Oh yea
I didnt think of that
0
Q: mysql_real_escape_string with PDO PHP

HarinderHello i am new to PDO so getting confused and getting errors ;) with mysql_real_escape_string .. can any one help, here is my code if(!empty($_POST) && isset($_POST)) { include ('connection_pdo.php'); $dbh = new PDO("mysql:host=$host;dbname=$dbname", $user, $pass); $source_url= mys...

also, @I'll-Be-Back , your validate() method has way too high cyclomatic complexity
you have to refactor it
private function required($value)
{
    return ($value != '') ? true : false;
}
hey guys
@tereško LOL actual no.
01:18
huh?
i am querying a bunch of rows from a database and i want to json_encode all the different rows. should I take the data and manually put it in an array?
@I'll-Be-Back aside from everything else that's wrong with that required() method, just so you know you can write return $value != ''; and it will do the exact same thing
Also consider this
i'm using PDO to query the database
header('Content-type: application/json');
$result = $DBH->query("SELECT * FROM results WHERE model='equity_options'");
foreach ($result as $row) {

$data .= "[" . $row['id'] . "," . $row['input'] . "," . $row['output'] . "," . $row['date_time'] . "],";

}
echo json_encode($result);
@DaveRandom Oh.. I have should have known that.
when i echo $result all i get is: {"queryString":"SELECT * FROM results WHERE model='equity_options'"}
what should i be json_encoding?
01:22
please , @hanleyhansen , stop making shit up and read the manual
i figured it out
what am i making up?
@hanleyhansen No.
$result = $DBH->query("SELECT id, input, output, date_time FROM results WHERE model='equity_options'");
$data = $result->fetchAll(PDO::FETCH_ASSOC)
header('Content-Type: application/json');
echo json_encode($data);
@DaveRandom Ok i see. I get it now.
@DaveRandom congratulations on giving him a fish
he will be back soon enough for another one
Im going to bed now, good night
01:30
@I'll-Be-Back Nighty night
> Google Chrome's connection attempt to zkoss.org was rejected. The website may be down or your network may not be properly configured.
@Lusitanian Is that the point, or are you talking about the actual content that I can't see?
actual content
except they need a www, apparently
tldr another framework, this one even more innovative because it removes the need to write javascript
how brilliant
Awesome. So all this like 6 hours of JS I've just done was totally pointless? I need a(nother) drink.
Actually it may quite possibly be pointless. I am quite intoxicated and I suspect that when I look at the last couple of hours worth of work in the morning I will revert it immediately.
> // TODO: Rewrite this. It kind of sucks.
^^ actual comment in some code I wrote this evening
02:07
lol
02:19
@DaveRandom i recognize that style of comment
it's the "i've gotta do this really quickly to satisfy someone's requirement but goddamn i'm too tired to do it well so uh jquery" blues
i don't really think that's very melodic though
03:21
@edorian Very good idea....
03:39
hola @PeeHaa
 
2 hours later…
05:31
Hi, I'm trying to use pear auth in my webpage. I'm trying to follow this: pear.php.net/manual/en/package.authentication.auth.intro.php, where I make login optional. Can someone help me get this working?
 
1 hour later…
06:40
people still use pear?
what's a better authentication library?
i usually make my own...but whatever works for you :)
not everybody can or should do it from scratch
I thought that would take way too long especially for someone as new to web programming as me. What do you think is the best auth library out there? Preferably one that uses PDO
good evening @PeeHaa.
why i cannot do this: $('.hvTableRowOdd td a").append('ff');
06:45
pear's apparently is pretty stable (or was, at least, a couple of years ago...lol)
so if you want to use it, have fun
yes, I use pear
does look like it was made for php 4 though
least that's what the deps say
it depends, but you have some older code in there.
but you can report bugs against current PHP versions.
It's not that you must run PHP4 to use it ;)
there are enough differences between php 4 and 5, i wouldn't trust php4 code to run quite right in 5
Take stuff from Pear2, that is PHP 5 only.
Apart from that, you should try first.
06:48
why i cannot do this: $('.hvTableRowOdd td a").append('ff');
So is pear good or is there a better auth_lib? Preferably something easy to implement for a newbie like me
@Olli It's an invalid variable name, you should see parse error.
@hakra it's jquery
I'm asking it here since no one replies at @JavaScript room
@Olli because " can't terminate a string started by '?
@chao lol :D i was quite stupid
06:50
@Olli Your strategy to get help is contra-productive.
@hakra ?
@Olli also there is something called IRC and there is more than one jQuery channel in it.
@Olli Go there, wait until you get an answer. Or leave it, but the PHP channel is not full of jQuery folks.
ok
Also you might want to use an editor that highlights javascript syntax.
notepad++ is pretty good :)
06:52
ok
And you do not make much wrong with tools like ttp://www.jetbrains.com/webstorm/
yeah...i really like phpstorm by the same company
it's a really nice ide
Notepad++ is cool, but I normally suggest you take something that works on more than one platform.
Another nice leightweight GUI based editor is Geany.
So any good recommendations for user login authentication libraries? Using PDO and something easy for a newbie
06:55
i'd suggest gvim / cream, but lol
@JohnBernal Authentication against database?
does the pear2 auth stuff use pdo?
@cHao Let's check.
or is it still tied to pear's old db abstraction libs?
I made a website that has registration and inserts information into a database and everything done. But now I need to implement login and account management functionality
so that's why i'm trying to find a library to use to implement it quicker, rather than start from scratch
06:58
@hakra I do use notepadd++ but i am developing a userscript
Pear Auth uses multiple DB layers, but it looks like PDO is not listed in the features.
and the engine has its own source editor
if I use np++ to edit i would have to copypaste all the time
@Olli you know that userscripts file are on disk somewhere so you can use your standard editor?
I do not know where they are actually
@JohnBernal Have you taken a look into packagist.org, too? packagist.org/search/?search_query%5Bquery%5D=auth
07:00
truth be told, i hear these days pear is where packages go to die
If you want to re-use libraries, you should really try with composer, see getcomposer.org
@cHao well, there are other places where code dies more. Pear has moved to github last year / this year and it's now easier to contribute.
It depends a bit what you need. There are some pretty well working libraries in pear and also pear is some kind of infra-structure.
There is more use then just a library by some author.
Hmm so which on on packagist should I use?
However we never managed it to come close to pearl cpan :)
Which is a very good example to run a library library.
I'd also say, this has to do as well that many PHP coders were only running their own instead of looking for components in the past.
For example some projects have even taken over libraries and never contributed patches back upstream.
That's a pity and counter-productive in the long run.
So now we have got quite a level of fragmentation.
well...i never really understood the process of submitting fixes
so
Yes, but you can submit in the end :) But I know what you mean.
07:06
Can someone please tell me which auth library to use. I don't think you guys understand how new to this stuff I am. I don't want to start using a library and waste hours figuring out how to work it
@JohnBernal Waste hours? I'm sorry but I can not suggest you library_for(PDO, Auth) with these two parameters from top of my head, but I'd say, if you run your own, that will waste you more than just a few hours.
truth? i dunno. like i said, i typically make my own. just pick the one with the most downloads
long as it doesn't require some framework you're not using
You normally take a auth library if you want to support more than one backend.
i've seen a few recommendations for ulogin
documentation apparently sucks though
I'd say it does more than just authentication. However, that might not be bad, just saying, because for a "quickier" integration this might add overhead.
@JohnBernal maybe you can say what your authentication needs are. Do you only need auth or do you want to have user-objects, handle password hashing algorythms etc. pp.?
Do you need backends next to PDO?
07:16
why is this actually wrong:
​$("a").each(function(){
    var size = $(this).html().length;

    if(size > 20){
        var old = $(this).html();
        var new = old.substr(0,20);
        new += ""+new+"...";
        $(this).html(new);
    }
});​​​
because you're using .html()? :P i dunno...what's it not doing?
it should truncate links automatically
chrome says, "unexpected token 'new'"
pick a less keywordy name
ok
thank you it worked.
but how I could modify that it would calculate the needed truncation from div width?
that's more involved than i care to get
07:22
ok
I thought I was in the wrong room, for a minute, but, no, this is definitely the PHP room.
101
A: Calculate text width with Javascript

CMPalmerCreate a DIV styled with the following styles. In your JavaScript, set the font size and attributes that you are trying to measure, put your string in the DIV, then read the current width and height of the DIV. It will stretch to fit the contents and the size will be within a few pixels of the st...

@hakra I need it to handle user logging in, recovering password, logging out, account management (change password, upload stuff), password encrypting, etc
@Olli
http://chat.stackoverflow.com/rooms/17/javascript
@vascowhite there is no ppl there
currently
07:24
so, it doesn't mean we want to see it. if we did we'd be in that room.
keep in mind, the chat is persistent. people can see your question and reply hours later
they don't necessarily have to be in there right this moment
if you have real questions that couldn't be answered by 30 seconds worth of googling, though, ask on SO
that's what it's there for
07:40
@JohnBernal Okay, you need more than authentication alone. You will have to try different libraries anyway, because you need to do it multiple things. That's just integration, so this is not only about giving some suggestion "that just works", it need to work for your application. That is something only yourself can find out. However, your initial way of handling this is very good: To look for a existing library instead of rolling your own.
@hakra ah okay. i'm going to try to use PEAR and pear_auth, so this library doesn't have all the functionality i want?
@hakra are those links for me O.o?
@JohnBernal Pear Auth is about authentication mainly, not managing sessions. It supports many backends, see the link. You want more than that (and you do not need all these backends it looks like).
@JohnBernal No, see: chat.stackoverflow.com/transcript/message/5380759#5380759 (starred first message on the right)
Have you considered using a framework for your application? For example for the Symfony2 framework there is a bundle (library) called FosUserBundle that is about these jobs.
07:56
@hakra hmm will give Symfony2 a try. That has libraries to handle all the functions i need?
Hello guys, I'm having a problem in a foreach loop, can't get the title from an YouTube API, this is the very small piece of code I'm using: pastebin.com/zb4g9DRY , kindly please someone take a fast look over it.
@JohnBernal The framework itself is somewhat small and modular, but many so called bundles exist (that are libraries specific to symfony2). Also it integrates well with the composer package manager. Probably you want to learn about composer first and/or learn how to install symfony2 via composer. You can do a test-project by-side to play around with that. I'd say it's worth. Even if you don't use symfony2, you would learn how to use composer.
@Mihai You need to enable error reporting to learn more, see your code here: codepad.viper-7.com/zJbfYG
I have the error_reporting(-1), enabled, I just didn't showed in the paste, although if I could debug that error I would have done it myself instead of requesting help here.
08:17
@Mihai $value-title is almost certainly incorrect. perhaps you meant for that - to be ->?
->*
I hand written that code, and forgot to put the sign >
$value->title->{'$t'} should be your title, it looks like
@cHao thank you so much, it worked.
whazzup
morning @Gordon!
08:28
Morning
bored ;-)
@hakra: he has written code for php and c#, and he want's to know why doesn't code work. isn't that legit question?
08:42
@glavić It's one of these common: Please port my code from Language X to Language Y requests. That is not legit at all.
You could also ask how to write a regular expression in C#, which would be much more helpful for future readers of a question.
morning @hakra and @Gordon
morning @NikiC
09:04
@hakra: aha, ok.
Good morning
09:26
@Gordon: Thanks for the edit, this btw is how I did a DCI in PHP example. I should put it on github, it's not that I'm really confident with it, but to have the example.
somebody there?
@hakra I was tempted to provide an example to the OP but I'm not sure whether he is really looking for DCI or Proxy Object Pattern.
@hakra actually, I already wrote it gist.github.com/b04f1f5df48ac1571776
@Gordon Well, let me take a look if I get this up quickly so I can show you.
grough gist: gist.github.com/3803589 (not all code, but visible how it works)
09:46
@hakra hmm, shouldn't the increaseBalance and transferTo call be in the respective Roles?
Well as you can see, I do not have context objects here.
This variant is influenced by the Scala example, which does it this way.
This comes with the price that this is only possible with subjects that allow to serialize and deserialize.
The roles are injected/mixed at runtime.
As this already put things into context, I'd say it's fine. However I must admit that with the implementation code examples in the book, the switch between C++ and Ruby did leave some gaps.
I first tried to black-box implement it in PHP but did run against a wall properly grasping the context. As I already had seen the scala example before writing, that black-box approach didn't do well in the end ;)
I like the idea of having a Cast/Ensemble as a dedicated Object.
@hakra had the same issues with the Context. It's essentially Global State the way they use it and it needs iterators (or yield)
10:08
@Gordon I dunno. the way done in Ruby it did not work for me. I'm still on fixing up the repro so I can push the example. Will let you know.
stackoverflow.com/questions/6737114/…. Not sure about the question itself, but the answers are hardly answers
10:25
mornings
stackoverflow.com/q/12651864/212940 yet another multidimensional array question.
@Gordon I think the question is OK, but as you say the answers are a bit lacking in detail.
in JavaScript, 15 hours ago, by rlemon
I miss being a noob... participating in main site questions and the chat would be so much less rage filled if I were just stupider.
@vascowhite I flagged it for mod attention. lets see what happens
@tereško well, ignorance is bliss
GUI and Transaction are merely faked.
The running example is in example/app.php
@hakra you are not supposed to code while on vacation ;)

« first day (714 days earlier)      last day (4460 days later) »