« first day (1217 days earlier)      last day (3731 days later) » 

12:00 AM
I really don't get this obsession with calling your child xx junior, it seems to be very #murica as well
Do you people have no imagination at all?
 
user895378
In #murica we don't need imagination because we have television.
 
user895378
@DaveRandom Also, the PHP_STREAM_FLAG_NO_FCLOSE trick works perfectly
 
Doesn't the UK have a lot of former King Fuckface IV? That's way past junior
 
Yeh but pretty soon you'll end up with everyone being called Dave Smith followed by numbers, and then you might as well just have numbers, and that would make the US basically one giant prison
@cspray Yeh but they're Germans
Also treating the Royals as if they do anything even remotely normal isn't going to end well
@rdlowrey Awesome sauce :-)
 
user895378
$onRenegLimitCallback = function($client) {
    // 1. Stop reading data from the malicious client
    stream_socket_shutdown($stream, STREAM_SHUT_RD);
    // 2. Get the IP address
    stream_socket_get_name($stream, TRUE);
    // 3. Add user to ban-list here
    // 4. ???
    // 5. Profit!

    return FALSE;
};
 
12:04 AM
@DaveRandom Well, from the looks of things creating one giant prison is kinda our M.O.
 
user895378
IIRC we have one of the highest per-capita incarceration rates in the world already
 
user895378
Also, when reading the example code above: s/$stream/$client/
 
@rdlowrey You do recall correctly. War on Drugs and all. We sure do love us some war
 
user895378
USA: two-time defending World War champions.
 
...and spoiling for a rematch, going for the treble
 
user895378
12:09 AM
We've always been at war with Eastasia ...
 
So, hey, how about that Comcast-Time Warner merger?!
 
user895378
OMG WTF
 
var_dump(levenshtein('peskie', 'ruskie')); // int(2)
 
There's no way that passes through regulators.... right?
 
user895378
@cspray I don't see how it possibly could
 
12:11 AM
@rdlowrey Well, technically they aren't direct competitors; Comcast isn't a competitor in TW areas
 
user895378
Thinking about merging with Comcast.
 
And they're already in charge of the pipes and the content...
Which seems like a huge, flagrant conflict of interest
But hey I'm just a random shmuck, what do I know?
 
Ain't nobody but me in charge of the content of my pipes
 
I love that Comcast sold it as "pro-consumer" and called the cable/ISP industry in America "highly competitive"
I almost choked on my coffee this morning when I read that part
 
This is depressing given the whole Beiber thing
 
user895378
12:14 AM
@cspray Anyone who's ever bought cable/internet in this country knows that's a joke.
 
user895378
I mean, surely people like Google are putting lobbyists to work to stop that ... right?
 
@rdlowrey I know that Google is trying to help fight off some legislation in Kansas and (some other state); teleco companies wanting to block municipalities from providing their own fiber optic networks
I'm sure they aren't gonna be too happy with this either if I had to guess
I can't imagine anybody being happy with it except Comcast/Time Warner shareholders
 
Well, we've (effectively) only had one fixed line provider in the UK since forever. We have a cable network originally installed by Nynex (offshoot of AT&T, bizarrely) in the 80s but it only reaches about 15% of the UK and everything else is BT, no matter what all the resellers tell you it's still BT
 
@DaveRandom If you don't mind me asking...what do you pay for Internet? What speeds do you get?
 
user895378
I mean ... I'm a dirty capitalist pig and I still think that ComcastWarner merger is a travesty.
 
12:17 AM
I could give two shits about the TV aspect; my primary concern is the ISP related impacts. I rarely watch TV
 
I pay £48/mo for a 60/6MB, TV and phone line
That's from Virgin, who now run the cable network
I also have an epic TV package, which is a bit of a waste of money tbh
 
@DaveRandom For a not-as-fast Verizon FIOS I was paying 2.5x that rate
I had higher upload but it wasn't symmetric
Right now I'm currently a Comcast victim :(
 
user895378
@DaveRandom That's roughly similar to what I get for tv/net with TimeWarner ... Also with the epic TV tier :)
 
Well internet speeds in the UK have had a massive boost in the UK in the last 2-3yrs, about 60% of the population can now theoretically get 120Mb
 
It was them or a DSL service that doesn't even qualify as broadband
 
12:20 AM
No-one provides symetric to domestic users though
 
I can't work from home remotely on that
 
It's a totally different ball game in this country though. You have a very widely distributed population but the huge majority is in cities, it's much easier to provide fast speeds to a larger proportion like that. In the UK everyone is kind of spread all over
Except for London, which has like 15% of the UK population
 
@DaveRandom Yea, that's true. I mean, I understand the economics of it
But also at the same time I consider Internet, at this point, a basic utility
i mean, you can't apply for jobs without the Internet. I know, when I was laid off from the monastery I worked at I tried to go in person and be all presentable and shit
They laughed at me and told me to apply online
 
You worked at a monastery?
They need web developers?
 
Yea, I was a lay worker for the Monks of New Skete.
haha
They do! But at the time I wasn't doing development work (officially)
Most of my professional life I've been in food service or teleconferencing. I've only been a "professional" developer for about 2 years now.
At the monastery specifically, I smoked cheese.
 
12:26 AM
@cspray Ahh right, so you were just abducting people off the street and scaring them into donning hooded cloaks, standard sales stuff
@cspray Don't the papers get greasy?
3v4l.org/kfVsfO <-- never knew you could do that
 
@DaveRandom Believe it or not, no paper involved. Hickory smoked cheddar, gruyere, gouda, goat cheese, etc, etc.
@DaveRandom So thankful for flash block, you bastard
 
Happy Friday! :-P
 
I normally check the status bar and I trusted you
Well, I'm pretty sure if I don't take my dog out he's gonna wind up destroying the house. So, I'm outies. See you guys later
 
@cspray Well, there's your first mistake. Keep it up and it will also be you last :-P
@cspray Later
I need to go to bed actually, nite @all
 
user895378
@DaveRandom night
 
12:41 AM
Teh fuck - "Otherwise, there may be multiple files which seem have the same file name."
 
12:54 AM
"Creation science" carries the same intellectual weight as "dragon anatomy". #creationdebate
^^ I lol'd
 
@Danack Where did that guy come from? Just all of a sudden he's showing up in all the places
 
1:09 AM
@cspray I don't know. I think he's been associated with php for a while - but it's only recently that's he's started going nuts on internals.
 
Hey all. Working with some legacy code, and have lots to learn concerning OOP. The object I'm trying to get information from is a mix of arrays and objects.
For instance: $autoshipItem['autoship']->id
That returns null.
When I dump $autoshipItem, it shows "id:private"
How do I go about getting that value for id?
 
In my opinion, dump the type of $autoshipItem['autoship] with get_class(), track down where that is in the codebase and look at the implementation
I know tracking down the implementation might be easier said than done in a legacy system
Or you could just use reflection if you wanted quick 'n dirty
 
reflection?
 
Ah ok cool.
 
1:22 AM
Although there are legitimate uses of reflection I feel that accessing a private property like that when there might be more suitable mechanisms already in place seems like a code smell.
 
Ok cool. I found the class and there is a method for getting said id. (hopefully). This is a big hairy application. Trying to learn how to approach these issues better.
 
read the code
=]
 
first week at a new job, so trying to feel my way around.
 
@blackairplane Well, I've worked in my share of big, hairy applications. Best advice is read the code and don't change anything unless you ahve to
 
1:23 AM
Depending on how hairy try to get some unit tests on it
 
@blackairplane Have you tried using a debugger? You should be able to set a breakpoint on the line where that variable exists, and then inspect the object type directly.
 
Yeah, I've been very careful to change much.
This particular piece is a PHP generated JSON response to HTML, about three layers thick. If I try to echo or dump anything, it breaks the response, and thus won't open the page.
This app is different than anything I've built or worked on. haha
I've heard about unit tests, but am not familiar with the concept. I'll google, but any good resources out there that you'd recommend?
@cspray
 
/shrug, I got into it by doing it. I installed PHPUnit, looked at the docs and just did
I actually think the PHPUnit docs have gotten pretty good over the past couple versions
 
Oh ok, so it's a framework that allows debugging, benchmarking, etc?
 
No, it is a framework that allows the creation of unit tests. Benchmarking, debugging are totally different things
In computer programming, unit testing is a method by which individual units of source code, sets of one or more computer program modules together with associated control data, usage procedures, and operating procedures are tested to determine if they are fit for use. Intuitively, one can view a unit as the smallest testable part of an application. In procedural programming, a unit could be an entire module, but is more commonly an individual function or procedure. In object-oriented programming, a unit is often an entire interface, such as a class, but could be an individual method. Unit ...
 
1:33 AM
Ah ok. thanks. I have some reading to do, hah.
 
Also, to be honest...I wouldn't start unit testing on a legacy project
Do something small, personal and start the unit tests from the beginning
Trying to do it without knowledge in a legacy system sounds like a disaster imo
 
Yeah, I'm not going to touch much that I don't have to. Was planning on just reading documentation and trying some things.
on my own projects*
Trying to walk carefully around this application. It consists of everything being loaded with AJAX, and so going back in the browser resets the entire user experience. So bizarre.
 
Yea, I worked with a couple devs once that wanted to do all the things via AJAX
 
I was wondering if someone could help me figure this question out or be willing to chat with me about it.

http://stackoverflow.com/questions/21763408/if-statement-for-tinymce-plugin-justboil-me/21763622?noredirect=1#comment32922601_21763622
 
BANANA PANCAKES!
 
1:40 AM
WITH BACON!
 
@cspray yeah makes everything very hard to debug with dumps and echoes as I'm used to. (Not that I'm necessarily doing it properly, haha). Just feels like your working half-blind because any output breaks the JSON response.
 
@Ocramius Fuck yea dude. Fuck yea.
 
17 mins ago, by Danack
@blackairplane Have you tried using a debugger? You should be able to set a breakpoint on the line where that variable exists, and then inspect the object type directly.
 
@DanLugg actually ate banana+bacon pancakes in amsterdam - AWESOME!
 
Shit, now I need to make that shit; like, naaaoooww!
 
1:43 AM
@Danack I haven't used debuggers. Are you talking about debuggers built into IDEs?
 
@blackairplane Yes preferably e.g. youtube.com/watch?v=LUTolQw8K9A
 
@Danack cool thanks. Will watch.
What IDEs do you all prefer?
 
@rdlowrey can the InjectorBuilder in Auryn be used to parse a json file with the injection definitions?
 
@blackairplane PHPstorm - it's so much better than everything else.
 
Cool, downloading it now.
 
1:47 AM
@RonniSkansing Nope. It doesn't do that.
 
PHPStorm is pretty unopposed as far as IDEs go, but NetBeans is fairly decent too; great debugger support.
 
@Danack thanks
 
@DanLugg BURN THE HERETIC.
 
Shut-up-a-you-face.
 
any one tried IntelliJ with PHP plugin?
 
1:49 AM
;-)
 
@DanLugg Wass - the - matter - you - hey!
 
Boppa-dee boop-ee! Bip-a-dee boppa boppa-dee boop-ee!
 
@andho why would you do that? IntelliJ and phpstorm are made by the same company, but one focuses on php....the other doesn't.
 
Are there any PHP gurus here that would like to review some code?
It's not for me, it's on Code Review.
 
@Danack i don't want to have a separate IDE for every language I use. That's why
 
1:52 AM
I dunno why this was so hard to find
 
lol XNA; is he referring to .NET XNA for game dev?
 
@Danack Hmm, not a very relevant link. I know there are PHP gurus here, I'm asking if there are any that want to review code.
 
^^ instead; why don't you just post a link to the repo, or pastebin where it is; if someone looks they can get back to you.
 
@syb0rg Yes - and I'm saying: don't do that. "Say here is some code, I would appreciate any code reviews for it"
aka don't ask to ask - just ask.
 
1:55 AM
5
Q: Help me review this PHP cryptography implementation for a web-based file server

user3068322I'm not a dedicated cryptographer, so I'm looking for someone to look over these functions I wrote and let me know if there are any implementation errors leading to security vulnerabilities or just anything I should improve. Any other comments about improving performance, etc. would be great too...

There is one.
 
"I'm not a dedicated cryptographer, so I'm looking for someone to look over these functions I wrote "
 
I didn't ask the question, it just needs answering.
But answering 71 questions is a bit much for today ;)
 
I'm not a doctor, but I play one on TV.
 
@Danack think it would be useful to have json file parser for auryn?
 
@RonniSkansing o.O?
 
1:58 AM
@Ocramius I mean like a route.yaml|json parser but just for bootstrap injections
 
@syb0rg anytime someone who is not a cryptographer writes their own functions it is either going to be at best only as good as a library function, and most likely full of holes. PHP has library function for encrypting stuff. Not using them, and writing your own is a bad idea.
 
@Danack Good start to the review. Just put that into an answer, and show some examples of what library functions the OP should use.
 
@RonniSkansing I see - maybe, heh
 
^^ So very true about the crypto. The only thing you should do if necessary is write wrappers to encapsulate the function calls, as to ensure that they conform to whatever interfaces your application is expecting.
 
@RonniSkansing I'd suggest adding php-based stuff first
 
2:00 AM
@Ocramius I am not sure what you mean by adding php based stuff.
 
@syb0rg Have you heard the phrase "Delegation is the key to success?" ?
@ircmaxell Some noob needs pwning please - codereview.stackexchange.com/questions/36679/…
 
@RonniSkansing it would just be like a huge array for its DSL, no?
 
@Danack That's what I came here to do. :P
 
Hmm I see the issue, but could that not be solved via. generator iteration?
 
So, I just started my first dev job working on a team as a jr. dev. Any advice for how to ask the right questions when it comes to looking for help?
 
2:04 AM
@RonniSkansing Yes and no. Yes it would be really good to have something in place for people to be able to start using Auryn more easily. No, json sucks for config files, because you can't add comments to it. The only reason to have a config file at all is to make it so people can edit the config file easily - and making a gui editable config thing should probably be totally independent from Auryn, and might be impossibly to make in a generic enough way.
 
@Danack You can't comment JSON?
 
@DanLugg No, because doug crockford is a dick.
 
Apparently. Fuck, that sucks.
 
Hmm good answer Danack
 
2:05 AM
Never knew that; I just assumed that block comments were allowed
 
"I removed comments from JSON because I saw people were using them to hold parsing directives, a practice which would have destroyed interoperability. I know that the lack of comments makes some people sad, but it shouldn't.

Suppose you are using JSON to keep configuration files, which you would like to annotate. Go ahead and insert all the comments you like. Then pipe it through JSMin before handing it to your JSON parser."
FUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU‌​UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU‌​UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU‌​UUUUUUUUUUUUUUUUUUUU
 
Thanks @Ocramius. Reading now :)
 
@blackairplane And linked from their - catb.org/~esr/faqs/smart-questions.html
 
@Danack Wow, that's terrible. Who cares if people are using them for directives/annotations? It doesn't destroy interop at all actually.
 
I'm pretty good about trying lots of stuff before asking for help. The problem is that I'm not always sure what to ask, if that makes sense. haha
 
2:08 AM
@DanLugg Yeah as much as I hate annotations (heat of a thousand suns), removing comments from a human readable data format is an even worse idea.
 
By using a comment, you're expressing acknowledgment that they're not intended to be parsed.
 
@DanLugg A lot of Crockford's decisions about some JSON things have ben "wtf?!"
 
*shrug*, that's bollocks.
@Danack Comment based annotations suck; when a language explicitly supports them, then that's syrupy deliciousness wrapped in bacon.
 
21 mins ago, by Danack
@DanLugg BURN THE HERETIC.
 
@ircmaxell If you are interesting in reviewing PHP code, it would be awesome if you could join our chat room over there.

 The 2nd Monitor

General discussion about codereview.stackexchange.com - Welcom...
 
2:11 AM
4 mins ago, by Danack
FUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU‌​UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU‌​UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU‌​UUUUUUUUUUUUUUUUUUUU
 
Exactly.
 
@Danack could you give me a suggestion for a more sane format to use for config files?
 
@DanLugg People are trying to use the convention that single underscores keys are 'reserved keywords' in json, and double underscore keys are ignored i.e. treated as comments - but that requires projects to follow that, and, for example, composer doesn't.
 
@RonniSkansing do et with PHP first, then add JSON/XML/Yet-Another-Markup-Language to it
 
2:17 AM
@Ocramius I am still not sure what you mean. It is already php =] And I love it. So now I am just trying it out in other use cases.
 
ah, nvm, guess I needed to read the uri first :P
 
hehe
but that does look alot like what I was thinking about.
 
Blech. I hate having to clone... in lieu of value-types.
 
@RonniSkansing As @Ocramius said - php is good. Although those elements are the minimum required, I'm not sure that all the information can be contained within a config file. For example on my web server, I inject different stuff based on the server name that people are accessing. I can put those things in different config files, but it's just so much easier to have them in php code.
 
2:24 AM
sure I can agree on that. But what if the injection becomes coupled with client interaction. Lets say a CMS. Client can make a route, choose injections and provisions. Handling this would be better in config files (or x) then editing raw php files. (In this case the end user is a typical CMS end user, they only use the controlpanel...)
 
@RonniSkansing php files are valid config files
 
@RonniSkansing Technically, it'd be easier editing it in a DB, and then caching it in APC, rather than fiddling around with config files.
 
<?php return ['foo' => 'config, magic!'];
 
I want to delay the decision really =]
file, db, radiowave whatever
 
And yeah with php 5.5, being able to do FunkyLogger::class and having it be inspectable by the IDE (so any typo gets detected) is also easier than a config file.
 
2:27 AM
Danack and Ocramius, thanks for the input. It has been worth gold
 
right, that is a huge plus
<?php return [MyCoolInterface::class => MyCoolImpl::class];
 
I've still got my arms up in the air over it not having been typeof(MyType) </bike-shedding>
 
@Ocramius but then we are back to the huge array right?
 
@RonniSkansing what is the problem with that?
been using that format over XML/YAML/JSON for a while now (2 years or so) and it's frikken awesome
provides flexibility and is as readable as json
plus the IDE can provide inspections and you can define things like closures or inject expressions
 
And if you do it right, OPcache caches it for you, without having to cache it yourself.
 
2:29 AM
right
So yeah, it's not portable to another language, but dumping it to json requires seconds
 
So if it was a use case like I mentioned previously (weird cms). If it was flat file based, you would save a php file?
 
@RonniSkansing not if user-defined
But yeah, I'd still use a PHP file for config, and the DI config is likely not something the user touches
 
And I can not see anything wrong with it other then it might invoke some memory/performence issue at some point but I have not really looked into it. Its a gut feeling.
 
@RonniSkansing having it as YAML/JSON requires some things that you may not forsee:
1) you may need a parser (json extension or polyfill if not installed, YAML parser if using YAML)
2) you need to manually cache stuff
3) you WILL have stat calls
4) you cannot get OPCode caching, and if using HHVM, the JIT won't really understand all the weird loops of the parsers
5) ... add things that I didn't think of yet ...
 
1) I hate having to introduce a parser. (especially YAML)
2) I hate caching stuff manually
3) I have to google that
4) I hate both not getting op cache and hhvm
I am really not into hhvm, phalcon etc.
=]
 
2:35 AM
eh, currently compiling HHVM here =_=
I may need another PC just for that :X
 
You must really need the speed?
 
@RonniSkansing no, I'm just compatibilizing some of my software with it
 
whatever Marco
 
@andho lol
 
@Ocramius I guess, I do not get anything other then HHVM brings more speed
 
2:37 AM
but i like you points on using PHP as configuration. Never thought it like that
 
Yea I guess that will be the end solution in my test case as well
 
@RonniSkansing it's about evaluating the technology out their. OPTIONS
 
@RonniSkansing yes, that's the main use case - a couple of my customers have already switched to it
 
@andho next up will be a php chip
 
and playing with new stuff ofcourse :P
 
2:40 AM
any of you play with microcontrollers and that sort?
 
I just bought an arduino uno. Haven't done much with it yet.
 
^ I have one of those as well. It is pretty fun..
Well the best solution is when I do not have to code anything =] InjectionBuilder::FromFile($ocramsPhpConfigSolutionWithOPCache)
Thanks ;)
 
@RonniSkansing Yeah, I have some ideas for it, but haven't gotten around to building anything cool. What have you built?
 
@blackairplane I've heard that they work pretty well with Raspberry Pi's
 
@RonniSkansing InjectionBuilder::fromArray(require $ocramsPhpConfigSolutionWithOPCache)
 
2:48 AM
Now we are talking
@blackairplane some sensory stuff. =] Mostly I am using it to learn avr-gcc etc.
But as you know, it can be hard to find the time
 
(its the microcontroller on the uno)
 
ah ok
 
@blackairplane did you get some stuff with it (sensors, diodes etc) ?
 
Yeah, it came with some basic components. I've done a bit of small electronics projects in the past, so the idea of bridging physical and digital was fascinating.
Thought about building a basic device with a few weather-based sensors in order to learn arduino.
barometric pressure, sunlight, temperature, etc.
 
2:55 AM
other then the barometric perssure the sunlight,temps are real cheap
 
Where do you buy your components?
 
In a danish webstore called let eletronik
 
cool cool
 
btw 123d.circuits.io, lets you play with a virtuel breadboard, anduino (uno) and quite a few components. You can even write the embedded script, and check input/output in serrial
 
awesome. I'll check it out
 
2:59 AM
if you want to check it you can just register with a whatever@mailinator.com
Anyways I am going to bed, thanks for the talk
 
You as well. Have a great night
 
and thanks Ocram and Danack for the in depth talk about config files.
 
@RonniSkansing I probably could of added - I use php for almost all config files e.g. mysql, nginx - with github.com/Danack/Configurator Although most of the time it's overkill, being able to loop over stuff if required, or pulling data out of a DB, makes writing config in PHP way better than a simple data file.
 
3:29 AM
@Danack configurate -- Did not know this was a word :-)
 
@DanLugg I won a bet last year against someone who thought that I had made up the word paginate.
 
Really? Paginate is much more commonplace; configurate however, blew my mind a bit.
Also:
Feb 7 at 5:00, by Dan Lugg
Jan 31 at 12:54, by Dan Lugg
 
Hmm...I think it's a UK form of verb which is dropping out of usage - There's also disorientated, which the yanks are discombobulated by as they always spell it disoriented.
 
*shrug* I like it; and I'mma gonna use it.
I need more C-fu, because I wanna try to implement ReflectionFunctionAbstract :: createFromCallable(callable $callable)
 
3:45 AM
@DanLugg I'm quite tired - and about to go to bed, but Auryn does that in here - github.com/rdlowrey/Auryn/blob/master/lib/Auryn/…
 
Yea, I've implemented it similarly myself. But it belongs in core.
That shouldn't be something left to userland.
 
yeah - and you should be able to pass functions as functions, rather than as strings.
 
Yea, the whole non-first-class function ordeal is kind of a pissoff; but that's the way it is.
 
@DanLugg yeah - "you can have first class functions, but only if you don't give them names".
 
Bollocks, I say! Bollocks!
The whole thing is fucked though; there's no way to back-port first-class-member functions into PHP at this time (...is there?)
 
3:55 AM
tbh I have no idea. You'd need to talk to someone who understands the parser - basically you need to be able to do:
function foo() { echo "whatever";}
$functionToUse = foo;
 
Well, that might be fine; but then there's this:
class IFuckedUp
{
    public $foo;
    public function foo() { }
}
$fuckedUp->foo; -- what is it dereferencing?
 
@DanLugg You could say that is the variable and $fuckedUp::foo is the function.
but anyway - nn. I need some sleep so I can call someone an idiot tomorrow.
 
But then $fuckedUp->foo won't be bound to the expected $this pointer; it won't be bound to anything.
@Danack Word. Night sir.
 
user895378
@RonniSkansing yes. $injector = (new Auryn\InjectorBuilder)->fromFile($filePath, NULL, 'json');
 
user895378
That API should be improved though ...
 
user895378
4:01 AM
would be better if it were ->fromJson($filePath)
 
@rdlowrey Had any input on the delegates idea?
 
user895378
@DanLugg I haven't thought much more about it but I really like it.
 
I have one big recurring question on the matter that I can't quite resolve; where should they live?
 
user895378
Where, as in the source code?
 
Yea.
At global, they'd be autoloadable, but since they're so short, and would probably be used in the context of a given interface/class, perhaps they should be members.
If they were statically addressable class members, they'd conflict with the constant name table, but would still be autoloadable.
 
user895378
4:11 AM
If they're members doesn't it prevent me from using them with standalone functions? Or am I misunderstanding your meaning?
 
No, it wouldn't prevent you; example of global:
delegate AcceptFooBar(Foo $foo, Bar $bar);
function test(AcceptFooBar $callback) { }
And static-member:
class MyClass {
    delegate AcceptFooBar(Foo $foo, Bar $bar);
}
function test(MyClass::AcceptFooBar $callback) { }
I suppose they could be subject to visibility modification too.
Moreover, the parent class should be able to use them provided they were static members:
class MyClass {
    delegate AcceptFooBar(Foo $foo, Bar $bar);
    public function test(self::AcceptFooBar $callback) { }
}
 
user895378
Ah I see what you're saying. The member-level declarations aren't as important to me personally ... I'd use them more as global declarations
 
Yea, I think support for both would be great
Hadn't thought it through entirely before; I had some unresolved issues with the member-level declarations that seem to have resolved themselves in conversation ;-)
Blech, I wish PHP hadn't created different name tables for everything.
class MyClass {
    public $foo;
    public function foo() { }
}
^^^ should be illegal.
 
@DanLugg why so? property and method access have different syntaxes anyway...
 
5:26 AM
http://stackoverflow.com/questions/21763408/if-statement-for-tinymce-plugin-justboil-me

I recently updated this post with some new code and almost have it working. I just really need one of you guru's to take a look at my config.php statement and tell me where I went wrong. Please read the updated section to my question if you get a sec. I would greatly appreciate it.
 
@daugaard47 if($thisPage="notices"){ should be if($thisPage=="notices"){
You need to compare, not assign
An easy way to avoid such mistakes is to always put the constant first like so if("notices"=$thisPage){ will cause PHP error so you know you made a mistake.
Same goes for else if($thisPage="classifieds"){
 
@crypticツ the Yoda condition
 
@crypticツ thanks going to go try it now!
 
Hi guys
 
hey
 
5:38 AM
I have a requirement where I need to check whether the string is in a particular format or not
 
@crypticツ so use two == on the classifieds or just one?
 
"123A" or " 123 " or "1A " or "1"
 
@daugaard47 when doing a comparison you use two, or three if you want to compare type as well.
 
how should I check whether the string is in any of the above format?
suppose the string variable is $string
I know how to do this in javascript
using /regex/.test($string)
but don't know in php
 
@crypticツ okay thanks
 
5:41 AM
@daugaard47 this is all basic PHP stuff which you should know to do PHP correctly. Here is the docs page us1.php.net/manual/en/language.operators.comparison.php
 
@crypticツ I know I know... Been flying by the seat of my pants for to long now. Just got a bunch of courses at phpacademy.com to state really learning this stuff. I'm tired of looking like a bonehead. lol
 
@daugaard47 the manual is the best place to learn from
 
@crypticツ It just seems like another language to me. its hard for me to understand what the heck there talking about. I guess If I read it over and over and over it will start making sense.
 
How to test the string format using regex or without using regex?
 
Jes
Good morning friends
I have a response url
url returns me objects and how to extract the data and set it to form fields
 
5:57 AM
@Mr_Green you could search google for the equivalent of that javascript in php
@Jes good morning. I have no idea what you said
 
Jes
@andho i have a response like this pastebin.com/JL5uriks
how to set the values or autofill form in cake
 
anybody used the Facebook php sdk recently?
 
@stewbydoo I did
going out now
 
> how to set the values
@Jes how to set the values into what?
 
@andho I know preg_match
but any other way?
I don't know why but I have preg_match
 
6:02 AM
@stewbydoo an year before yes
 
makes me irritable
 
Jes
@andho into form fields
 
I downloaded the SDK and try putting my app id and app secret into the credentials for the example.php that came with the SDK
It allows me to grab the feed
but I want the statuses
whenever I try doing that I get nothing returned
 
if the object you showed is in $obj, just call `$form->setValue('guid', $obj->guid);`. Ofcourse I am assuming CakePHP forms will have a `setValue` method.

You can read the CakePHP manual to find out how to set the values automatically. If they don't provide the functionality, you can search the internet or write your own.
@stewbydoo check if your requests works directly from the API browser or whatever they call it
 
they do
 
6:07 AM
then try without the sdk. Using something like curl, or chrome extension like Postman or Advanced Rest Client
@stewbydoo you can also show me a sample of the code that doesn't work
 
let me see if I can get the request to work with Postman
 
6:37 AM
@DaveRandom 3v4l.org/kfVsfO that's 404 .. what's there?
 

« first day (1217 days earlier)      last day (3731 days later) »