« first day (719 days earlier)      last day (4226 days later) » 

9:02 PM
@cHao @MadaraUchiha regular-expressions.info/charclass.html#shorthand - PCRE matches only ASCII [a-zA-Z0-9_] in \w apparently.
Also note that US English wouldn't be as broken if you people would learn to spell and talk properly. Color indeed, what do you people have against the letter U?
 
@BrunoVieira: It's also considered good practice to not eat in the bathroom. No laws against it, but I bet you don't do it. — Madara Uchiha 14 secs ago
 
lol
 
nice one :)
 
rad
oh wow
 
9:15 PM
> I'm programming in php for years,
0
Q: getting values from associative arrays in php

Mohsen NyI'm programming in php for years, but i have encountered a redicilous problem and have no idea why it has happened. I guess i'm missing something, but my brain has stopped working! I have an ass. array and when i var_dump() it, it's like this: array 0 => array 4 => string '12...

 
morning
 
This guy is such an unbelievable rep-whore
 
9:30 PM
Hey guys does anyone have any experience with paypal buy now button integration?
I experience some problems
 
It's a filthy one alright ±D
 
rad
how do I capture the value in the string using regex where the value could be a hyphen or a number?
I tried: ([-|\d+]) , but it captures just first digit if its a number, if its hyphen, it works okay
@MadaraUchiha any thoughts?
 
@DaveRandom Example?
@rad [????] means character class, "one of the characters in here"
You want ([\d-]+)
 
rad
oh
 
@MadaraUchiha Question @PeeHaa linked above for one. But everywhere I turn with the dead simple ones he's already been there and stated the bleedin' obvious.
 
rad
9:37 PM
@MadaraUchiha oh man, you are not awesome XD
jk
 
@rad Madara Uchiha is not "awesome". He is fearsome.
 
rad
lol
how are the elements inside [???] are to be separated?
using | ?
 
@rad They aren't separated, it's a character list
[?:'] means ? : and '
 
rad
I see
 
@rad If you're learning regex, bookmark regular-expressions.info, it is a very useful site for beginners and I regularly use it as reference.
Also if you're working in PHP, keep in mind that what you are actually working with is PCRE.
 
9:44 PM
@justin Why do you keep deleting your code?Shaquin Trifonoff 16 secs ago
He keeps deleting his code.
1
Q: onclick button doesn't work in firefox

justinI have this code: <H4> <b> <span style="color:blue;cursor:pointer" onclick="showImage(6)">test</span> </b> </H4> My onclick button doesn't work in Firefox, can you please help me?

 
@ShaquinTrifonoff To be fair I would delete that code. Mostly because it sux.
 
@DaveRandom It does. But then, for people to help him...
It'll end up as community wiki if it goes on like this :P
 
@ShaquinTrifonoff I might get out my dejQueryfying stick if he's not careful...
 
Oh well, rollback to revision 6 it is :-P
 
rad
@DaveRandom thanks man
 
9:50 PM
@DaveRandom lol
 
rad
In regex, (.*) matches everything, how do I capture the string that is before first occurance of "<"
example string: "abcd efgh < qwerrty asdfggg <"
is it: /(.*)</
?
 
@rad You need to learn about greediness
You're nearly right, but you need a ? in there ;-)
Although @cHao has already given you another way of doing it:
1 hour ago, by cHao
@rad why not ^([^<]+) ?
 
rad
buffering...
stack overflow error
 
10:08 PM
lol
 
rad
system reboot
buffering back again
 
@rad May I recommend more beer as a good coping strategy, usually works for me.
 
rad
lol
so, finally, /^([^<]+)/ worked for me
 
@ircmaxell Aren't you supposed to be on a plane very shortly?
@rad Oh yes that's an important point: php.net/manual/en/regexp.reference.delimiters.php
 
rad
does ^ mean the first occurrence??
what about 2nd? 3rd? 100th?
was I missing ^ when I was trying /(.*)</ up there?
@DaveRandom ?
 
10:17 PM
@rad ^ asserts the start of the string
It is a "zero width assertion" - in other words, it does not match a specific character, neither does it consume a character.
 
rad
my stack is not willing to take anything
except beer..., I am stressing out because tomorrow is my last day at work
 
For example, ^am matches ambulance and amongst but it does not match ham or greek amphora
 
30 minutes until boarding. Sitting at the bar waiting.
 
rad
@DaveRandom right, I am aware about that
time to log off
 
@ircmaxell Are you going via Amsterdam or something? If you're flying direct from NJ to UK in half an hour it'll be 5am when you get here I think
 
rad
10:23 PM
@ircmaxell safe flight man
@DaveRandom thanks a lot man
good night everyone
 
@rad np :-)
 
Land at 7 30 am....
Thanks!
And no, direct
 
10:39 PM
@ircmaxell Well don't get a taxi to the city from the airport unless you want to spend £30 on it, get the train. And if you do want to get a taxi, go to terminal 1 cos the taxi situation at T2 is often a bit bleak. And be prepared for some sh*t weather, it's been crap for the last couple of days. Also if you're looking for something to do tomorrow (if your not doing the tutorial day), I recommend this
 
hola
 
@PeeHaa I know of a bug with the address bar icon settings which is a very quick fix, anything else you're aware of? Would be good to put the current round of changes to bed and move on to the next lot :-)
@Lusitanian Sup G-man
 
'g-man'? :P
 
10:52 PM
PHP is also not the language to use dependency injection in my personal opinion. It definitely has it's place but I just don't see the usefulness when you can greatly simplify things through way of a global database instance. To keep your separation of concerns just code to interfaces and things will work out. Just wanted to add this tidbit. — sean 19 hours ago
 
@Lusitanian Yeh it's been Ghetto Thursday for me. It's Transgender Friday in 8 minutes, got to get that hood-speak out while I can dawg
 
aghhhhhhhhh
did sitting on the naughty step not teach you anything?
 
Briefly. But I live for the moment.
 
@Lusitanian My code was using a global variable for my database, and I am currently rewriting everything with dependency injection...
 
@DaveRandom smh
@Jocelyn how did you unit test then?
 
10:55 PM
@Lusitanian What does the Sydney Morning Herald have to do with anything? :-P
 
lol
your sarcasm scarily reminds me of myself
 
Please bare in mind that I am British, and my sarcasm is congenital.
Heh
 
@Lusitanian I didn't. That's one of the reasons why I am switching to dependency injection now.
 
genital
 
yup
it's as bad as i thought @DaveRandom
@Jocelyn ah
Nothing drives home how poorly WordPress is coded by being forced into working with it
 
11:00 PM
@Lusitanian Denied. What you need is a beer.
 
Four years from now I'll be allowed to experience this 'beer'
 
Yeh, like I believe you have let a beerless life to this point
 
"Beerless" is one of the greatest words I've seen on the internet.
Congratulations.
 
Completely but awesome and on topic for that last few messages:
 
11:03 PM
> Cock does not go in Duck
 
Who knows a light-weight and efficient software (for Windows) to check signatures and calls of functions in PHP code? The number of arguments in my functions signatures and my functions calls do not always match, and I would like a way to detect them, so I can fix my code more easily.
 
@Jocelyn Validation tool, IDE or what?
 
php codesniffer might
phpstorm has multiple kitchen sinks, it also might
if not
i'd make something with @NikiC's Php parser
 
You could build a regex-driven validation tool in PHP fairly easily, although it would be pretty difficult to account for runtime type variations with respect to type hinting
 
@DaveRandom a simple Windows program that doesn't use much disk space and RAM, I just want the list of all function calls with incorrect number of arguments
 
11:08 PM
@Jocelyn seriously: github.com/nikic/PHP-Parser --- @NikiC has put blood and sweat into that --- not to mention a few tears
so ya might as well use it :P
 
@Lusitanian I like the way that seems to support features that PHP itself doesn't yet support (yeild)
 
PHP supports yield (see below)............
 
@Lusitanian What's the deal with the clearly-Charlie-Brown-but-not-really kid? If they've started making more/remade that I may have to kill myself.
 
how to inject content in template files? they gave me some template files packed with lorem ipsum and asked me to turn into a CMS (thats what they exactly told) without any template engines.
 
...and who exactly are "they"?
 
11:24 PM
my employer
any ideas?
 
user50049
@Gordon Yeah, I generally unwikify something if all someone is doing is trying to improve their posts (and there aren't many authors)
 
@fallenAngel Well what exactly is wrong with <div><?php echo $content; ?></div>
 
Hum
 
@Dave the templates are not written by me and they will be wriiten by the non developers. they packed it with dummy data
 
@NikiC ?
 
@DaveRandom nothing, he was just humming is all
There's probably something wrong with eating 800 calories worth of Junior Mints in a single day
 
@fallenAngel ...right. So how are you supposed to know where the content goes if they don't tell you putting some kind of computer readable place holder where it should go? (which, by the way, is a fairly decent definition of a templating engine)
@Lusitanian I thought he might be commenting on <div><?php echo $content; ?></div>. Which I personally find to be a hateful way of writing code, but if that's the requirement then that's the requirement.
 
Yeah, I mean, <div><?= $content; ?></div> is much cleaner!!
 
@daverandom They have not told anything that (template engines or placholders). what i was thinking to load the html in DOM and parse out the id and map them to database when contents retrieved insert them by id. i noticed that they use id where contents tend to be editable
 
11:40 PM
@Lusitanian Use <?= $content; ?> at your own discretion, but be aware of potential issues with portability if the code is ever going to be moved to another server.
 
@Lusitanian Still not got out of the habit of not doing that for short_open_tag reasons yet. But I'd never do it anyway, I never mix PHP and HTML outside of codepad demos.
 
@Lusitanian Alternatively, you could add an id to the <div> and use AJAX to pull the data from the database and insert it using innerHTML (or .html() if using jQuery)
that would be the cleanest route
 
@fallenAngel Well you could do that and it would work, but seriously... why? It's truly ridiculous to opt for that over some form of proper templating. Unless you just feel you have too many spare system resources.
 
@DaveRandom PHP is already a templating language, but current development trends generally opt for keeping a good separation between languages, and for good reason.
 
@DaveRandom then what do you recommend?
 
11:44 PM
@ChrisClower Just before you embarrass yourself any further, @Lusitanian does know what he is doing and was, I imagine, joking. People who suggest using jQuery for anything don't usually find a warm reception here ;-)
 
Did I suggest jQuery? Sorry, must have missed that part...
Your suggestion of using a templating engine however is quite embarassing
 
@fallenAngel Well personally I recommend writing your apps properly :-P but if you are in a situation where you are given some HTML templates and you have to put content in it, then templating engines are the way to do it, because they are idiot (i.e. designer) proof.
@ChrisClower I would never recommend templating. Ever. Ever. But the parameters set out by this OP somewhat require it.
 
@DaveRandom Well, I'm not going to contribute to further confusing the OP by continuing an argument over how it should be done, so I'll let you handle it.
 
@ChrisClower ...and I didn't mean to come across quite as condescending/confrontational as that came out, internet sux for friendly sarcasm
 
@DaveRandom No worries.
 
11:50 PM
@DaveRandom Not sure I follow.
 
@DaveRandom i Cant see any other way right now
@ChrisClower I dont mind to hear your opinions or ideas
 
@DaveRandom My only point was that if the OP wants to keep it as clean as possible, I'd pull the data in via AJAX and insert it into the div that way before I'd ever use a templating engine to try to simplify the aesthetics of the HTML code.
 
@NikiC So basically this guy is saying "I've been given a bunch of HTML with dummy content and I have to put some real content into it dynamically". So (admittedly, assuming that the "templates" are not static) the only sensible way to handle that situation is with content placeholders, which is essentially templating. Although I'd be happy to be corrected on that if you have a better way.
 
@Lusitanian @DaveRandom Thanks, I will give a try to these programs during the week-end.
 
user895378
@Stephane The substandard nature of the answers to your question have forced my hand. I'm going to make myself sit down and pound out an answer. It may take a while though.
 
11:54 PM
@DaveRandom I was more asking why you would recommend against templating ;)
 
@ChrisClower Problem with that approach is you're battering the network unnecessarily in my view.
 
How's that? A DB call is a DB call, whether it's requesting a script that runs SQL via AJAX, or whether it's doing it directly. Either way, PHP is still hitting the DB with a request.
 
@NikiC I just hate unreadable code, and I find HTML templates very unreadable, not matter how you do it. Tag soup, and all.
 
@DaveRandom What are the alternatives?
 
Sorry, not running SQL via AJAX, I meant to say AJAX requesting a PHP script that runs SQL
 
11:56 PM
@ChrisClower Yes but you've immediately added at least one HTTP request to each page load.
 
user895378
Anyone wanna see an example of people blindly following Symfony to the detriment of all mankind? Here ya go ...
 
user895378
0
A: Dependency Injection: How to pass DB around?

dagIm not sure if i really got your question but from my point of view your thoughts are missing a DI container component. This container is configured initally (like in a bootstrap context as kevinmajor1 proposed) and injected into your controller on instantiation. I think symfony2 and the componen...

 
@ChrisClower but it will be dependent to javascript (browser may be enabled it or not. for core content it would be not nice to be dependent for JS also it will affect in SEO
 
@DaveRandom That part is true, but it shouldn't have any real affect on the page loading speed, depends on the speed of the server though.
@fallenAngel If someone has JS disabled these days, they should be used to nothing working ;)
@fallenAngel That number is so low, you can't really dismiss using JS at all for that reason
 

« first day (719 days earlier)      last day (4226 days later) »