« first day (1147 days earlier)      last day (4027 days later) » 

00:00
@cspray never understood that ... what a daft default ... for consistency we should make file_get_contents do the same thing ...
@JoeWatkins Yea, I agree. I never did really understand it either
I've had enough of today, sleep now ... nite all
Of course after having gotten some more HTTP knowledge and working with other HTTP clients I wouldn't use cURL unless it was a really small one-off project that would never see the light of day or if I was being forced to by an employer
See ya
And even those small projects I probably wouldn't use cURL
+1 curl is mostly terrible, the more you ask it to do the more terrible it becomes ...
I'm gonna go sleep, but that's not really fair, curl is pretty good on the command line, a rock solid client, and it's API is not bad ... but how much do you think the author of the extension thought about it ... sending content to stdout by default tells you that they didn't think about it very much, or aren't very good at thinking ... its pretty much all (ext) implemented like that, get it working, doesn't matter how ...
bugs.php.net/bug.php?id=61797 it's not just curl ...
@JoeWatkins That is very true and I am referring to the PHP API and not really the CLI
00:11
fo real, sleep now :D nite all ...
00:21
@cspray Such as?
I am particularly fond of @rdlowrey Artax. github.com/rdlowrey/Artax
However, that might be too cutting edge for you. If that is the case then just take a look for PHP HTTP client libraries
From my own research it appears that Guzzle is a popular choice. github.com/guzzle/guzzle
user895378
@NoahHuppert You'll need PHP 5.4 to run artax. Guzzle will work with 5.3 and is fine as an alternative -- just avoid the curl_* functions -- they're awful.
When it comes to HTTP I would listen to @rdlowrey. His HTTP-fu is strong.
@rdlowrey Ok.
user895378
@NoahHuppert If you use artax and have questions feel free to ping me.
user895378
00:27
(within reason)
00:38
@igorw does Stack have a naming convention for repos names? I see stack-foo-bar as project repos names and then I see StackFooBar. Also I see your OAuth middleware has an OAuth folder which to store the other classes, while others I've seen store it in the same folder as the middleware class.
@crypticツ no official convention, but I'd recommend your-name/stack-foo
did the thing from the other day work out btw?
oh and for class names YourName\Stack\Foo
@igorw haven't tried yet, I did separate the config out though. Also going to separate out the validation methods into their own class.
@igorw should I call it stack-csp or stack-content-security-policy I just want to make sure people understand what it's for especially when calling via namespace as I want it to be descriptive of what the class is for, but it is a mouthful.
01:03
stack-csp sounds good to me
 
2 hours later…
02:33
Well, masscan looks like an interesting piece of software :)
good moaning, room!
@Jack howdy
are imgur.com images free to use? Or will using them land me in copyright trouble?
You should read the FAQ for that.
March 15th 2014 is when I predict the close-vote queue reaches 200k, and when I believe it will reach a singularity and become self-aware. I have no scientific evidence to back my claim, but you heard it on the internet so it must be true.
unfortunately that question isn't in the FAQ
02:36
@crypticツ The close votes will become Skynet 2.0
Bad questions unite!
filter_input(INPUT_GET, 'user_id', FILTER_VALIDATE_INT);Jack 12 secs ago
hehe
@Jack nice!
The best part is the "I think I'm having issues with this code" :)
02:45
#yolo
GET /w00tw00t.at.blackhats.romanian.anti-sec:) HTTP/1.1 ... wat
So with CUrl requests if you have any spaces or tabs in a GET variable it freaks out. There is the solution of righting a case to replace every single character that would make it freak. Or I am assuming you could somehow convert the string into proper form OR somehow get the full raw data of the GET variable?(with all that %20 = ' 'stuff)
@Jack oh man, don't mess with them they sound 1337
@crypticツ That request is coming into my server lol
@Jack yeah, I get them too
02:47
Together with a trigger happy Baiduspider.
@webarto I'm doing migration work on our old server, this is the new one :)
Ah :)
Exactly :)
02:53
@LeviMorrison GoogleGuy in da house.
@webarto The solutions in that article all don't make sense to me :)
@Jack Blah, you're not using phpmyadmin, are you? :P
@webarto Of course I am using phpMyAdmin, but here's a secret ... I don't run it from inside a subdirectory ... it's the site itself! =D
They would never suspect that shit
@cspray Thx.
@Jack Right, Romanian hackers, pfffft.
02:55
inorite?
Just a bunch of script kiddies, really.
user652649
'ning... does somebody know how to convert this apache 2.2 syntax Allow from env=ENV_VAR to the new 2.4 syntax? using Require
user652649
ah nvm, just found it -__-
Yeah! Install nginx :)
user652649
true, i should really
You've been hacked by real hackers when you don't know you've been hacked.
user652649
02:58
apache's configuration syntax is the uber definition of anti-technology
@Wesabi while you're at it install Linux as well =o)
@Wesabi I don't think you've seen sendmail.mc before :)
user652649
thankfully not
user652649
zero documentation about Require, i have no idea how it works, but i believe in the random
@Wesabi What are you trying to do?
user652649
03:04
SetEnvIf Request_URI ^/public_folder.......... NO_AUTH=true
AuthName.......
Require valid-user unless NO_AUTH is set
user652649
Require valid-user
Require env NO_AUTH
user652649
that works, i guess
user652649
how was order allow satisfy etc wrong, i don't understand why changing these things, after decades they exist :\
Blegh :)
Why not allow all for everything except the areas you need authorization for?
There's something very wrong about this question, but I can't figure out how to answer it constructively =/
user895378
Awesome! Adora was in my economics program in school and we used to work together ... This is why I need to stop building programming tools and actually use them to build something. $40M for house cleaning.
03:14
=O
@rdlowrey Nobody famous in my circle yet :)
user895378
Now I know who to complain to about all those annoying HOMEJOY ads on hacker news.
Anyone here using Uber from time to time?
Uber being the taxi service they mention in that article.
user895378
Never.
So I have the following array_walk($this->config->enforcePolicy, [$this, 'method']); however I don't want to have the callback be a method in the same class, but instead be the ctor of another class. called Validate. So would I do this? array_walk($this->config->enforcePolicy, ['Validate', '__construct']); I have no idea what I am doing =oP
03:19
@rdlowrey I've used them a few times ... the model is really nice, hop on and off without paying in cash.
The price, on the other hand, is ... ahem, fitting for a private taxi I suppose lol
@crypticツ I would go for anonymous function wrapper.
I haven't seen any language that has a dedicated syntax for such things.
Like, apply "new XYZ()" to this array.
@crypticツ Hold on, array_walk() will just throw away the newly created objects.
What's the aim here?
@Jack I don't need them returned? I am passing config arrays to the Validator to parse, if it finds an error it's considered fatal and just stops the script. So nothing needs to be returned, just needs to finish validation without any errors.
@crypticツ Static method then.
i.e. Validate::validate() or maybe something less lame ;-)
but I hear those were created by Satan himself =oP
So are constructors that do stuff =p
user652649
^
03:25
lesser of two evils =oD
IMO static methods are the lesser evil.
Besides, you're really using it as a function anyway.
@rdlowrey Unsung hero.
@Jack if I make that method static, it happens to call other methods in the class via $this, so does that mean I need to make them all static?
Where I am, for $20 you can get entire apartment cleaned, so this would fail probably.
Not probably, 140%.
user895378
@crypticツ Yes. Because static is a disease. It's contagious and once you start using it then it infects your other code.
user652649
03:30
class YourValidator{ function validate(&$item, $key){ /* move your constructor here */ } }

$validator = new YourValidator;
array_walk($this->config->enforcePolicy, [$validator, "validate"]);
user895378
@crypticツ Why would you want the callback to be a constructor?
user895378
Explain.
@rdlowrey I don't know what I am doing is my explanation >.<
@crypticツ is doing some weird shit lately.
@webarto crack
user895378
03:33
class MyConfigValidator {
    function validate($item) { /*...*/ }
}
array_walk($this->config->enforcePolicy, [new MyConfigValidator, 'validate']);
user895378
^^ What's wrong with that?
Our crack R&D team (OK, @bjori and @webarto) have developed a fix for those finding our new site too white: http://t.co/dfREhCU8iK
Guess what, I'm wearing those glasses and doing crack.
@rdlowrey well since you wrote it, probably nothing wrong with it.
user895378
@crypticツ No, I write lots of buggy code :) But that should do what you want.
user895378
I'm not really sure what you're trying to do, but constructor work is never a good choice and static is almost as bad. You'd need a legitimate reason to do either IMO.
03:36
homejoy.com LOL... this is not funny.
Latin/Hispanic/Spanic cleaning lady?
user895378
@webarto I'm shocked they're able to convince independent contractors to get bonded and insured for ~$15/hour.
That's not much there, is it.
user895378
No, it's really not.
I had $20/h sitting for 8h...
In Austria it would probably be around $30 for "independent" thingy.
user895378
afk. I need to go rethink all the life decisions that led to me not getting $40,000,000 in funding for a crappy idea and a functioning mobile app.
03:41
I cry a bit every day...
I think $40M would partially make me happy...
user652649
@rdlowrey ahah, don't do that
@crypticツ That being the case, then following @rdlowrey's advice would be a good alternative :)
Of course, if nothing in the Validator actually keeps any state, making all those methods static would be fine and dandy as well imho :)
Can you teach Google Glass to darken when php.net is loaded on your screen?
Some guy at citibank thought that "Credit Card Payment Due Alert" would be a suitable title when you still have seven days to pay your bills :)
Maybe they have the wrong concept of alert.
Or maybe they just want you to pay your bill ;)
user652649
03:57
I would say "Notice" is a better word :)
user652649
live tetris programming: es-mx.twitch.tv/copysh
user652649
he's user "copy" of the js room, i guess
04:58
I'll write code for anyone in a back alley for some monies or crack cocaine
3
holiday special =oD
user652649
lol
Hardcore.
Today I wrote:
.para em:not(.emphasis),
.para var,
.simpara em:not(.emphasis),
.simpara var,
.tbody em:not(.emphasis)
Nothing good can happen without some jQuery:
$('code.parameter').closest('em').addClass('reset');
user652649
man jquery's api really sucks... what's closest() supposed to do?
user652649
closest ancestor or descendant? :)
05:14
ancestor :) impossibru with CSS
user652649
not yet! they are going to make it
user652649
hopefully soon
Is there any people worked with ck editor?
@Wesabi @webarto @all
user652649
nope, think they all committed suicide
Dem inline code blocks.
Hopefully I won't break php.net again.
05:44
@reikyoushin 4 purchases so far, I can have a nice lunch :D
user652649
@webarto what are you selling? themeforest?
@Wesabi codecanyon but yeah...
user652649
yeah,, same company
06:00
I have a anchor tag like this:
<a class="className" rel="something" href="some link here"> some text here </a>
How should I get only the string present in href using php?
06:14
depends
if it contains a hash, then you won't get it
Hi, any help in my question in Yii and Query Builder? stackoverflow.com/q/20417025/2352236
06:34
This regex is working fine on my above issue :)
(?<=href=")((?!").)*
mornings
Jes
Jes
Hi friends
Good Morning
i have a batch file and i want to write arguments to it from a php file
how could i do this?
@Jes system('/path/to/batch arg0 arg1 arg2'); ?
Jes
Jes
@AlmaDo thanks for the help could you pls guide me
I have a form and i want to pass all the aruguments to the batch file
do i have to open the file?
06:42
@Jes what are parameters? I.e. does your batch expect them in some standard form? (like param=value) ?
Jes
Jes
@AlmaDo my arguments will be like username password city phone
this is an example /path/ -u " .$emailId ." -pwd " .$pwd ." -bookId " .$bookId ." -v " .$version
@Jes so what are you going to do if I use your form and enter ;rm -rf / as my name?
so, make your form fields to be names as your parameters, then
$params = join(' ', array_map(function($x, $y)
{
   return '-'.$x.' '.$y;
}, array_keys($_POST), array_values($_POST)));
system('/path/to/batch '.$params.' > /dev/null &');
yep, use escapeshellargs() for safe passing. Or else - restrict available fields by some array
Jes
Jes
@AlmaDo how would i use escapeshellargs()
@Jes like any other function
Jes
Jes
06:50
ok
here in your code in place of x and y i will pass my values
am i right?
I've never liked that kind of array_map() behaviour :)
@Jack well, it doesn't accept keys :( And - yes, there's array_walk() - but it doesn't return result :\
so both work for a half :p
@AlmaDo Yep
Jes
Jes
06:53
seems advanced to me.. i m just a newbee
@Jack btw - you've proposed keys passing for array_filter() . That could be a good idea for array_map() too
Alternatively, you use the array and map over the keys.
@AlmaDo The function can't be extended anymore
crap..
Yeah, back then they thought this was a good idea.
Jes
Jes
sorry if my questions are dumb
Can i pass the values directly without using an array .concat ?
vs7
vs7
06:56
Hi
@Jes if you are new then you better learn quickly. golemtechnologies.com/articles/shell-injection do some reading on security before writing your script
vs7
vs7
Morning
I have a problem
2
Q: How to Add Category Filter in WordPress Post Query

vs7I filtered the post's in my sidebar by using this code, $mostlikequerystr = " SELECT $wpdb->posts.* FROM $wpdb->posts, $wpdb->postmeta WHERE $wpdb->posts.ID = $wpdb->postmeta.post_id AND $wpdb->postmeta.meta_key = 'most_liked' AND $wpdb->posts.post_status = 'publish' AND $wpdb->posts.post_t...

Jes
Jes
@Patrick let me read
thnaks
wow.. btw
it's Friday :p
Jes
Jes
@AlmaDo thanks for ur time
Could any one be my mentor to guide me
07:17
6 messages moved to Trash can
No need to repeat your question so often.
And this isn't a secondary php-so channel.
07:27
good morins
morning
07:46
morning
mornin'
is it bad practice if say I have this property array in one class and I need the same array in another class and to make it a static property so I can access it in both without having to repeat the array? It's hardcoded.
@cryptic Why not pass it around as an object
then you can have some assurance that it remains immutible
@crypticツ Alternatively you can set it up as a class constant
07:52
@Orangepill what do you mean? This is the only call to the class: array_map([new Validate, 'parsePolicy'], $this->config->enforcePolicy); the Validate class contains the array which I need later on in other class to build my string.
@crypticツ are you writing to that array ?
in any of those classes ?
the array is just being used as a validation refernce
no writing is done to it
then you just pass the same array to both classes separately in constructor
so where do I store the array?
How is the array being generated?
07:54
it would be the pragmatic options and , since copy-on-write is used, no duplication of memory would happe
it's right now hardcoded as a class property @AshwinMukhija
i would keep it as class property, only injected from constructor
then again, maybe I am missing something here
I agree with @tereško - injection seems to be more reasonable in this case.
Hardcoding a whole array does not sound like a very good idea to me.
a different question is: by do you need validation "metadata" in two different classes ?
07:56
My Csp class needs the array later on, but it is the one that calls the above array_map() validate using the Validate class which is the one that contains the array.
I thing that might be the source of the issue ... something is a bit off
Basically, what I figure is that you have an immutable array which is going to be used once to be parsed/validated, right?
CSP ? "Canadian Ski Patrol" ?
@tereško Well the array is used in Validate class to validate the security policy array which is passed to it. The Csp (content security policy) class then uses the array when building the header values, if a keyword found in the property array is used as a policy value it has to be quoted per the specs.
@tereško w3.org/TR/CSP
Computer Science Professor more likely.
haha
CSP was such a bad choice lol, in terms of acronym I mean :)
08:00
it seems to me that having the same array in both classes is incidental
are you extracting different information from array in each case?
@crypticツ Why not save the policy array in a file and parse it into wherever you want to use it?
I guess if the two classes are intrinsically coupled then sharing a static array wouldn't be to much of a sin
@tereško Validate class, validates if a allowed directive is used, then checks for allowed keywords and other non-keyword values, then when building the header in the Csp class it check what keywords should be quoted per directive.
@Orangepill thing is, there is no need to have it static, since array is not being written
It would ensure scalability in your case, since I don't see any other use of the array but storage in exactly one place, and usage in exactly one place, as of now.
08:03
so in one case you check if directives match he keywords and in the other - whether keywords match directives (if I got it right, then it might be that you have two different data sets mashed in a single array ... then again, I know nothing about details of you usecase)
@teresko true
0
Q: How to get a part of string variable (without first 7 characters)

Raplus$str="http://stackoverflow.com" I need to get only "stackoverflow.com". That means I want to remove first 7 characters. How I do it?

dafuq
gist.github.com/KyraD/b075f04a07e5d5cf2e55 So in Csp class when building header I lookup the values in array for current directive. I then compare the values in policy to the ones in the array and if they match that value is quoted. In the Validation class I lookup to see if a directive exists in the array, if it does then I make sure keywords in the policy are allowed for that directive.
What's even worse, Barmar puts in an answer.
08:07
repfarming..
@Jack URL parsing is brilliant with substrings. :D
@AshwinMukhija any parsing is done with substrings. Surprise :p
@AlmaDo It is, but it considers every possibility. I'd love to see what happens when OP tries to do it with HTTPS. :)
@cryptic that seems sane enough to me, the data is static ...
@JoeWatkins so do I make it a static property then?
08:12
@crypticツ then I will stick to original suggestion to pass that array in constructor of both classes, where it the assigned to local variable .. since the array is not altered, no duplication of data will occur
I would, the data is static ...
@tereško no duplication will occur if you don't change the array, but you're making the argument stack bigger for no reason, the data is static ...
@JoeWatkins and why would you make it a static property? To write it from any location in code?
it's not written
it is set
why should it need to be written to be static
static means unchanging
08:14
i think, you re trying to spell "constant", but failing
can you have a constant array ?
gist.github.com/KyraD/a08ca0f0799b232f4c94 the Csp class is called that way so I have no idea how I would pass the array to it and also to Validate without having the user manually have to do it. Btw this is a Stack middleware for Silex/Symfony
@JoeWatkins :)
trick qn @JoeWatkins :)
@JoeWatkins so your argument is "since we do not have constant arrays, lets make a static property" .. that's just stupid
08:16
Good morning
static refers to the "binding" no?
it can still change in value.
I would like constant arrays, though.
@tereško no, that's not what I said ...
Out of principle.
@Duikboot ....
Frrr....
08:17
IDAY !!!
WHOOOHAAAH
Finally
aaand friday has started :)
Almost ended.
started? pff, i'm almost hitting the pub lol
@tereško I'm still inclined towards a file based system to store the directives. I don't see a point of saving it, or injecting it into the classes. It should be 'computed' when it needs to be used
08:21
> fatal: 'svn' doesn't seem to be a git repository.
you don't say.
hell yeah! Friday!
1 message moved to /bin/gif
:) nsfw
I wish my github commits will be at that picture with github logo :p
it's a nice gif though!
the never ending pour lol
yep. Like count($wiskey) = +INF;
08:24
@AshwinMukhija but it doesn't need to be computed though. The values are unchanging as they are what it is for CSP 1.0, when CSP 1.1 is ready, all I pretty much have to do is add new items to the array and maybe an extra validation function or so and it's ready to go.
then that's not static
you might store the basic information in a static array, but don't change it, that's not static ...
when you extend the array create a copy
it's basically an array of allowed directives and value for the current CSP version.
@crypticツ What I meant by computed was the parsing, nothing else.
@JoeWatkins I would be manually changing the hardcoded values, not changing it via PHP if that makes a difference.
is the array changed at execution time ?? (bit confused, dunno what a CSP is, is this a release process or what ?)
right okay, that's static, I thought you were changing them at runtime ...
08:27
@JoeWatkins w3.org/TR/CSP
I should just pin that =oP
is it's static at runtime. it more like configuration option. Place it to ini/xml/yaml ?
@AlmaDo it still has to be extracted and parsed
@AlmaDo Or php
you are missing the point
08:32
@tereško you're right, I've missed some sentences in discussion
also, I am fairly certain that, while we have been discussing the color of bike shed, @crypticツ has already moved on
hehe
@tereško I just used $GLOBAL =oP
now you are just mean
I'm not a fan of statics in general, I hate it as much as any one else when a class is made of static methods and member properties ... but sometimes, it's okay ... I think ... this is by no means polished code, but github.com/krakjoe/phpdbg/blob/master/tests/run-tests.php#L316 because it feels static, and so does yours ...
school run ...
08:38
@JoeWatkins static properties in pthreads are nice :-)
@JoeWatkins It's just because constants can't be arrays… that's perfectly valid.
Lol...
I've searched in google for strict definition of Jaywalker anti-pattern.. result surprised me
SQL?
yes
strange that such common problem with this great definition results in two my own comments on SO when searching via google
heh
I need that for this question - since I have a habit (he-he, SO brought that habit to me) to provide link for entities that I've used in answer
oops, stupid cross join
08:58
@bwoebi we actually have to work around limitations quite a lot, without noticing it most of the time ... github.com/krakjoe/phpdbg/blob/master/tests/run-tests.php#L7 I wonder it would have even registered that that is a dirty hack before a mention of constant expressions ...
why does github think there is D in phpdbg ? it thinks there is C++ too, that's kind of forgivable, but D :s

« first day (1147 days earlier)      last day (4027 days later) »