« first day (1824 days earlier)      last day (3131 days later) » 

12:05 AM
@Jesse That's a nasty cough you have there. Would you like a cough-sweet?
 
yes plox
So, I got a question that may come off as messed up but it is for sure an actual thing.
Why do foreign developers despise if else blocks?
 
I'm not sure in general, but apparently someone linked to an article saying that 'if statements are bad' in this room, and at least one person has become fixated on that idea.
 
I remember one of my first answers on stack
There was an if else and he commented something like "Ew, an if else, idk"
So i did a shorthand and he accepted the answer ...
Anyway, since then it has been common for foreign devs to hate them, case in point the starred messages on the right
since then *i noticed more
 
The thing I want to know is why it seems to be so difficult for some people to learn that "if you want your question answered, you need to be clear that you're asking a question." It's obviously a cultural/language issue - but it seems to be something that people just can't overcome.
 
agreed
"I have this thing and it does this."
me: "congrats"
 
12:18 AM
I feel proud for you son.
 
"you do huh? very proud of ya"
@Danack Had to scour for that I listened to a looong time ago when you made that comment
 
I wasn't thinking of a specific one - just the general tvtropes.org/pmwiki/pmwiki.php/Main/SoProudOfYou
 
Everything can relate back to Jerky Boys
 
12:49 AM
hmm
perhaps, instead of short closure syntax, what we need is block syntax
$myList->foreach({
    echo "Hello, $0!", PHP_EOL;
});
(probably not)
 
> $($x, $y => $x * $y)
$($x, $y use $offset => {$temp = $x * $y; return $temp + $offset})
 
1:04 AM
@Danack the => unnerves me
oh oh oh I know
eval(<<<PHP

PHP);
 
$($x, $y ==> $x * $y) then. tbh I think we're just out of decent two char symbols there though.
 
ooh ooh ooh
 
it's no sperm, but at least it's a derpy smile
 
use function create_function as λ;
array_reduce(λ('$acc, $n', 'return $acc * $n;'), [1, 2, 3]);
 
1:07 AM
@PaulCrovella please. Code is serious business $($x, $y :-| $x * $y)
 
god I'm half-tempted to do use function create_function as λ; for real
might even make a PHP library that's just create_function but for closures
 
E_TOO_STRINGY
 
oh
OH
I AM GENIUS
use λ as the actual operator
it's 2015, use Unicode
let's piss off @PeeHaa with ($a, $b) ➡️ $a * $b
 
can we build in 🐘 as an alias for phpinfo?
 
@PaulCrovella <?🐘
 
1:15 AM
<3🐘
how cute would that be
 
⚠️(🛂=1️⃣);
@PaulCrovella very
 
1:50 AM
good morning
@Sherif Yum
 
lol paul
 
@Orangepill Have you read the user comments on that page?
> Yes! Small, edible pieces of bite size rainbow in fact! Please be warned however that a steady stream of urine (rainbow) after consuming this product cannot be cross with another of the same. The result will be dark matter.
or
> You should not feed unicorn meat to another unicorn. - You will end up with Mad Unicorn Disease (MUD) and no rainbows.
 
*everything results in dark matter.
 
awesome
I love the first comment on this one
 
2:08 AM
Talk about dark and depressed.
 
3:45 AM
\o
 
things I'm going to do sometime soon:
revive void and make it a compile-time error, as @NikiC correctly pointed out was possible with my ruleset
anyway, night
 
· get a mayonnaise jar, fill it with vanilla pudding, eat in public
2
 
 
1 hour later…
4:55 AM
moin
 
moin Joe
 
5:12 AM
0
Q: Self Promting My product on Stackoverflow is allowed?

AlexHope you will close this question?(I'm happy) But check this question: CodeIgniter member based solution? Original answer: http://www.awesomescreenshot.com/0405bink78 http://webcache.googleusercontent.com/search?q=cache:NLT02M7Rx6gJ:stackoverflow.com/questions/9739682/codeigniter-member-base...

 
5:28 AM
there's nothing wrong with a bit of shameless self promotion ...
it's pretty much all I do ...
 
Any cakephp developer here?
I have one question regarding one convention in which i have doubt
 
6:10 AM
@AnmolRaghuvanshi I think you did not understand. Alex is trying to tip us off that some other guy is self promoting his paid service.
the question should be migrated to meta, and the question at cause closed, as it's really bad and opinion based anyway
 
Abe
@PaulCrovella LOL. but remove the mayonnaise first?
 
@FélixGagnon-Grenier i understand that so in these cases what one can do?
 
Abe
mornings o/
 
6:17 AM
\o
 
@Abe I hadn't considered not doing that an option - but hey, whatever you're into.
 
Abe
:P
 
I flagged the question for moderator attention mentioning it should probably get migrated to meta after editing the question so it looks less of a mess @AnmolRaghuvanshi
 
6:19 AM
Joe is trying to make up for our lack of Fred, I take it
 
but you really can just downvote and be on your way, there's no obligation to any of this
 
it's there every day
 
well I'm noticing a lot of it today ...
 
helpful is to add tags like * to your ignore list
 
6:22 AM
ok @FélixGagnon-Grenier may be sometime i get wrong so correct me anytime,and thnks
 
though even with a huge list of ignored tags I run out of close votes almost daily
 
I don't usually search that often for questions ... I been looking at my <10k rep for years now ... my profile is teasing me with mod tools :(
 
so I figure I should do some stuff ... ya know, answer some questions ...
 
(also you'd think a 53k wouldn't answer offtopic questions.. wtf)
 
6:25 AM
hi
 
0
Q: Unable to submit feed in Amazon mws

ShijinI am trying to check submit feed to Amzon MWS using the following code. include_once ('.config.inc.php'); $serviceUrl = "https://mws.amazonservices.co.uk"; $config = array ( 'ServiceURL' => $serviceUrl, 'ProxyHost' => null, 'ProxyPort' => -1, 'MaxErrorRetry' => 3, ); $service = new Mar...

 
yeah sure @AnmolRaghuvanshi, good job of posting it here anyway :)
 
anyone know about amazon mws feed api?
 
6:29 AM
they have amazing documentation
 
I'll never understand why people @thingThatMustNotFail()
 
i tried with that documentation
but no errro returns
i don't know is that a server related error
@FélixGagnon-Grenier I downloaded their sdk from amazon,ansd set up as per the documentation
but it does not return even an error
 
posted on October 14, 2015 by nlecointre

/* by SynxS */

 
unless you are testing a frontend, a browser is the wrong place to test, PHP should be setup differently for the browser than it is for the command line, where you should do your debugging ...
 
@Shijin What exactly do you expect to be returned to your browser?
 
6:34 AM
and don't silence things, it's never correct to deploy code with @'s in it ... never ...
@Shijin format or pastebin please ...
 
you mean wordpress does bad things @JoeWatkins?!
 
CTRL + K
1 message moved to Trash
 
wordpress is bad things
 
@JoeWatkins I do not get any result from invokeSubmitFeed()
 
mornin'
 
6:45 AM
morning o/
you have interview all the best :)
 
interview is in about 4 hours , so I have still time
 
7:04 AM
mornignb
 
morning o/
 
Hrm, do we have a global / broad financial exchange site? I can only find one regarding personal finances.
Never mind, found the appropriate site ^^
 
good mornings
 
Morning
 
Morning
Who used the mailchimp api v3 already in a PHP project? I made it work so far to signup users to a list, but I also want to be able to remove them. I need the '{email_id}' for that. But I don't know how I can get that one by only providing an e-mail.
 
7:17 AM
wouldn't some database know about ids when provided with an email? Surely someone must have thought of that when creating the api.... right?
hmmm nevermind. I've no clue.
 
> subscribers are identified by the MD5 hash of the lowercase version of their email address
 
Just found out I have to save that in my DB that hash
to make it possible to remove a user. ;) thx
 
or md5(strtolower($email))...
 
morning!
 
7:42 AM
oh
* Searching for the right way to set a user to 'unsubscribe' or remove him kb.mailchimp.com/api/resources (( kb.mailchimp.com/api/resources/reports/unsubs/… )) that's just the report but I have to execute that action.
 
@Duikboot Search for the api docs insteda
 
That always results in v2 or when visiting v3 the url mentioned above.
 
> DELETE removes an existing member from the list.
 
moin new peepz
 
> Position: Senior Backend Engineer
Languages: PHP, Rails, Sinatra, Node.js
ಠ_ಠ
 
Abe
7:53 AM
they exist
 
one of those things is not like the others... it happens to be the only language
 
Abe
it's more surprising that there's people using php ruby and js at the same time
 
why's that?
 
Abe
well, they are so different
 
stacks get complicated. my last company we used perl, java, xslt, php, c, xquery, javascript... bunch of different databases (sybase, mysql, marklogic.. at least one or two others)
and that's just off the top of my head, there was more going on
 
Abe
8:04 AM
wow, lol :P
 
@PaulCrovella That should have sucked
 
Abe
@PeeHaa o/
 
ohai
 
@PeeHaa Don't worry, it did. Primarily for unrelated reasons though, which is a sad thing to say.
 
@PaulCrovella short answer: no
long answer: noooooooooooooooooooooooooooooooooooooooooooooooooooooo
 
8:13 AM
I'd rather have more of a Middle-aged Backend Engineer position anyway
 
Morning everybody
I haven't been here for a long time since I moved back to Bulgaria
and I needed to arrange a lot of things
 
welcome back
 
Yesterday I was thinking about how there is AOP in Java that is available through AspectJ and I decided to check if there is something similar for PHP and I found Go! AOP PHP
which is really nice concept
I really like AOP for cross-cutting things like logging or caching
since you do not have to modify code and you need it in a lot of places and you have to inject loggers etc.
and with Aspect Oriented Programming it is easy to do
 
You don't need a framework for that
 
but I've noticed that it kind of screwes with your stack
 
8:17 AM
It's basically automated decorators
 
yes
exactly
 
You put /** @logging **/ above a class, read it by reflection, wrap it in a logger decorator dynamically. Easy
 
yeah, good point
 
1
A: Multiple different type inputs in one line

Joe WatkinsKeep code as simple as possible, keep the minimum number of variables and functions required for functionality. Think carefully about each requirement of the program, treat them as individual small problems ... Like this ... #include <stdio.h> #include <stdlib.h> #define BUFLEN 32 double con...

me, saying things in
 
@Jimbo how do you wrap it in a logger decorator, by injecting it?
there is also a PECL AOP extension
 
8:21 AM
@ziGi Logic: If object contains "@logger", create new Logging decorator which takes any object and wraps it, and forwards calls through to that object via __call(). Make sure it extends / implements whatever is required to pass this into the object asking for the decorated object, then pass that in instead
 
@ziGi o/
 
hey hey @PeeHaa \o
 
o/
 
@Jimbo that is a good idea but then you kind of mess with the Liskov Substitution Principle
 
8:24 AM
Only the fly it doesn't, decorator is a valid pattern
 
do you have any example of it?
 
Damnit. Every time I go to the d3js site I get lost in all the awesome stuff bl.ocks.org/mbostock/1256572
 
same here PeeHaa, same here
 
@PeeHaa never let clients find this sorcery, or they all want crap like this on their websites :P Altough it's pretty awesome :D
 
@JoeWatkins Don't you need to null pad that string?
 
8:30 AM
@Sherif which ?
 
Wait does sscanf pad for you?
hmmm I can't remember
 
posted on October 14, 2015 by nlecointre

/* by Chaninou */

 
@Naruto The thing is I want all that crap on their website :P
 
@PeeHaa No you don't, you just want to have it on YOUR website :P fuck the client ^^
 
@Naruto My website is still in the same state as a year ago when I thought I needed to refresh my site
My clients love shiny graphs though
 
8:36 AM
@Sherif you mean terminate, and fgets ... I think ... and yes, fgets gives you null terminated string ...
 
@PeeHaa As long as there is some bling bling on the first page, they are sold for all the other crpa behind it ^^
 
@Feeds so relevant to our coffee machine. hate when that happens
 
Hey, lets say you have some functionality like send sending a message and a some Chat service which abstracts this functionality. On failure it returns null and on success it returns the newly created message. Now if I want to do some authorization to check if the user is allowed to send a message I could put a proxy in front front of the sendMessage() method that does the check but then is it okay if it throws some sort of AccessDeniedException even though the interface it is implementing does
Not specify it throws an exception
 
@Sherif oh yeah, it does ...
 
8:54 AM
@tibanez If you put it "in front" (i.e. decorating), your object could catch that exception and do something there?
 
@Jimbo Lets say the interface for chat contains sendMessage(), Both my services implement this interface. It accepts a string and returns a message on success and null when it fails. If my first service does the authorization check and then if that succeeds call the other service. The thing is the interface does not specify an AccessDeniedException can be thrown so is it weird if my first service throws one after doing the authorization check?
 
So catch the AccessDeniedException and return null within your chat object
 
The thing is it would be from some sort of controller/handler which calls this sendMessage method which then does the authorization and then internally that delegates to the other service calling sendMessage()
So my problem here is that the interface is sort of lying because it does not specify any exception can be throw when calling sendMessage(), maybe I should add that to the interface?
I don't want to have this one chat service which has a dependency on some object to do authorization and then has dependency on some validation and DAL stuff too. I want to keep the dependencies for each object small and keep each class doing only little tiny things
In a really strict OO language I possibly would not even be allowed to implement the interface and then have a throw new AccessDeniedException inside the method
 
So your services are decoupled. Your logic would go, in your handler... "if auth object says authenticated, chat object send message"
Your send message chat object does not need to know about authorization
 
9:10 AM
@Jimbo But in order to send a message to a user you must first be friends/connected to them so I want that check to be done as soon as sendMessage is called
So my idea is to do the authorization check straight away and that then delegates to the "real" sendMessage method which does validation, sends data to DAL
 
hmm ... tacos for breakfast are nice
someone's talking about OOP .. lemme see, if it's anything interesting
@SergeyTelshevsky you should be drinking tea
there is this awesome tea shop in "Spice" supermarket , you should take a look
@tibanez I would just use this approach: stackoverflow.com/a/9685039/727208
 
Decorator. Called it.
 
@Jimbo woa there
calm down
 
@tereško too bad I'm rarely on the other side of the river these days, but when I'll be there, I'll surely pay a visit. How did your interview go?
 
I think the same company had also a shop in "Alfa"
 
9:23 AM
morning
 
@FlorianMargaine Lol? :)
 
@tereško So you would say have some sort of SecureChat or ChatBoundary which wraps my real Chat service?
 
@tibanez if you want to restrict the access to the chat service, yes
and that boundary/membrane can be responsible for throwing the AccessDenied exceptions
 
@tereško Is it okay for the wrapper to throw an AccessDeniedException?
Okay cool
 
well, from "outside" the wrapper looks like the original class
 
9:25 AM
But since the sendMessage() method of the real Chat service does not specify it throws that exception is it still okay?
As long as I have a handler for that exception somewhere outside the controller which can then generate a response
 
that's a bit tricky bit there
 
Yeah that is the part that is annoying me
 
well, you can have the decorator that has access to the shared error list
 
i caompare two arrays by sub keys and the array has a value with x,xx % and i want to ignore the % but not delete. any ideas, how? maybe preg_spli
 
and, instead of throwing the exception, it just dumps another error in that list
 
9:28 AM
@tereško Yeah that's true. A language like PHP will let me get away with throwing the exception but in theory I don't think it is correct for the decorator to throw an exception when the interface of the real service does not specify it can be thrown
 
@Andrea Great!
 
It seems so convenient though to just be able to throw the exception and have a handler outside the controller to catch it and handle it
 
@tibanez it kinda depends on what is your goal. The decorator lets the security to be an independent part of the application logic.
there is also the benefit of having a single location for all the access rules
if you access control is inside a service, then every time you change something in your approach to authorization, you have to go manually through all the services
 
@tereško So would you say it is not too bad to throw the exception in the decorator object? It is for sure more convenient and probably cleaner. I like the idea of having the decorator be its own sort of layer/boundary which must be passed before getting into the real application logic.
Yeah that is very true and would be a headache for maintenance
 
@tibanez you do not have to throw an exception
 
9:31 AM
@Jimbo yeah, just messing
 
Ah good, thought I'd said something wrong :P
 
@tereško I will go with the error list so
 
the decorator can have access to you main error service .. or something like that
 
@tereško when ACL(Access Control List) is useful ?
 
Connected via SSH to a server >> Typing goes so slooooooww
 
9:39 AM
@Sajad ACL in particular is beneficial when you have you have users with individualized permissions. That's common in content management (CMS) and customer relation management (CRM) systems.
 
ah
 
there are other approaches to implementing authorization system, like MAC and RBAC
 
tnx
 
for example, in StackOverflow you basically have MAC .. what in "spy movies" is usually referred to as "security clearance level"
 
9:42 AM
@rdlowrey @bwoebi @NikiC Those ReflectionFunctionAbstract changes broke Auryn. travis-ci.org/rdlowrey/auryn/jobs/85281964 :-(
 
 
@tereško I see ...
 
Kay Chaos tomcatno
 
@kelunik Ah, right. Reflection is turning standard Closures to fake Closures too…
 
@GhanshyamKatriya what does it mean?
 
9:52 AM
@bwoebi You gonna fix it?
 
@NikiC yup
 
Hai gies. I have serious problem with php . When ajax sends data to php ,php don't work as supposed
 
@NikiC nice work @ bugs.php.net/bug.php?id=70644
 
ok now what errors are you getting ?
 
Abe
$100 that no further details will be given
@NullPoiиteя shh
 
10:01 AM
@tereško What do you think of system where you have multiple decorators, sort of like a chain. You call sendMessage on the ChatBoundary, it does authorization, it then delegates the call to a ChatValidator, it validates the data and then talks to the DAL. Is that too brittle and rigid
The validation part seems to be the weirdest, how the validation layer would then go talk to the DAL.
 
I've seen that before...
 
@Abe i am just trying to be less rude :)
 
@Jimbo Is was it successful? or prove to be bad?
 
@tibanez you have "I have a new hammer .." problem :D
 
$server = IoServer::factory(
        new HttpServer(
            new WsServer(
                new Chat()
            )
        ),
        8080
    );
That's what Ratchet does
 
Abe
10:03 AM
@NullPoiиteя :P
 
@Jimbo Yeah that's true. Internally though is the WsServer just adding itself as a listener to the HttpServer in it's constructor or is the HTTP server actually holding an instance of the WsServer?
 
@Jimbo I read "Racket" at first and was confused because it didn't look like racket code at all
 
@tereško I have a new hammer but would what I said above be a good or bad approach?
 
@tibanez decorators should be used only when you need a non-invasive way for adding a functionality without adding shitton of optional dependencies. Validation and DAL are not optional parts of your application. Instead they are composite part of your Chat service.
So, no, it's not a good idea to make everything a decorator.
 
@tereško That's true
 
10:09 AM
What I use decorators for are usually authorization (not authentication) and logging .. because I really hate the "null logger" approach
 
@kelunik done...
 
@tereško Oh yeah logging is a another good use
 
@tereško Agreed. I also use for caching
 
@tibanez That's about what I do.
 
@Jimbo yeah, in some scenarios
 
10:13 AM
@tereško One thing I don't like though is naming the class. For example I would like to talk to the Chat service when sending a message and not the ChatBoundary or SecureChat. I could just call the decorator Chat but then what do I call the class which it is wrapping
 
@Sjon Thanks :) I'll try to salvage the failed siphash work by giving robin hood hashing another try. Last time that failed because integers were not hashed at all -- might work with some cheap hash.
 
@tibanez If I'm logging my chat message, I have a Chat and a LoggedChat (the decorator)
 
@Jimbo Oh yes that is very simple and clear, I like it
 
Another option is to use the observer, where your Chat object loops around an internal list of observers and just calls a method on any attached, if any are
But I haven't actually used that yet, it's just theoretical
 
So I call my chat SecuredChat maybe?
 
10:15 AM
ok, time to get ready
I have to be at a job interview in 45min
 
@NikiC Isn't it actually enough to multiply the integer with some random odd value?
 
  [RuntimeException]
  usleep is not suitable for use in multi threaded applications, use synchronized Threaded::wait
 
@tibanez it depends on how specialized the class actually is. Because it is conceivable, that you would use the same decorator to act as authorization boundary for multiple services. In which chase I would just refer to as AuthorizationMembrane
 
@bwoebi No, that doesn't help at all
 
@JoeWatkins Could you skip that warning when no threads are used?
 
10:19 AM
Think about what the hashes of (0..N)*(2^16) will be
 
@tereško Okay thanks
 
@NikiC not sure…?
 
@bwoebi Well, multiply them by a large odd number ^^
The point is that the factor 2^16 doesn't change
 
@tereško One more thing, what about when getting data from services? For example: Getting a conversation by ID, you can only get that conversation if you are a participant in it so the decorator would call the real chat service, it would get the conversation from DAL and then the decorator would check if the user is a participant in the conversation, if so it would return it?
 
@NikiC oh, that's a factor… somehow the notation irritated me
 
10:24 AM
@tibanez Well, everything is going to be secured isn't it
@tereško Ooh, Membrane. Lol, that's one way of looking at it, or Layer :P
SemiPermeableAuthorizationMembrane
 
@Jimbo so you would think that is okay? The getting a conversation through the decorator?
 
@NikiC right, but we could strip all the trailing zeroes first (to have an odd number)
allows at most bitsize collisions by default
but … mhm, the all our ints will be odd
well… I should think first ^^
 
:D
 
but that siphash thing looks extremely expensive
 
It is
For integers it's really expensive
Which is why it doesn't seem like a good idea for PHP
 
10:32 AM
but isn't it possible to just have relatively simple integer fuzzing via some random number which makes it unpredictable?
at least unpredicatable enough to not have tons of collisions
 
It's likely possible
The question is how and how do you prove it
 
@NikiC Hi! I've been reading into PHP's CV optimisation, but I'm confused as to why it works differently in PHP 7 (3v4l.org/1c85F). I don't suppose you could enlighten me on this? :)
 
@tpunt it's very simple when comparing the opcodes: there's no longer a FETCH_R generated for the local symbol table in case of the silence opcode … hence it should work exactly the same now like without @
 
Isn't it possible to use SipHash for string keys and DJ33 for integers?
 
@tibanez I don't know, I think that authorisation through a decorator might not be the way forward... simply because you're going to have to decorate everything. There must be a better way, and I don't know what
 
10:41 AM
@nikita2206 the issue is that DJ33 is predictable…
 
@bwoebi So why was there that extra instruction in pre PHP 7 then? Oversight?
 
@tpunt The reason is that @$a cannot be CV optimized (otherwise the $a fetch would fall outside the silencing region). The previous implementation was just overly eager in that it didn't do CV optimization on anything within a silenced region, rather than dealing with the @$a case in particular.
 
@bwoebi for some reason I thought there wasn't enough integers to make a slowdown only with them (unlike string keys)
 
@Jimbo I'm just going to stick with the decorator for now any way. The two main methods startConversation() and sendMessage() will be wrapped by a SecuredChat decorator and then for retrieving conversations I will just talk directly to the Chat service probably
 
@tibanez Are you using websockets for this?
 
10:45 AM
@nikita2206 sure there is… mapping a 64 bit space to e.g. a 20 bit space… (because 2^19 entries in array)
so, there are like a 2^44 possible collisions in average
all DJ33 does is fuzzing in a predictable way.
 
@Jimbo Yes and no. Basically the client wanted to use Layer.com for the chat. They provide a REST API for sending messages and stuff but obviously they do not know our business rules like you must be connected to a user before sending messages to them so what happens is to send a message you send a POST request to our API, it does the checks to make sure you are allowed to do that and it then talks to Layer.coms API to create the message which in turn sends the message to any connected clients
using websockets
 
If collision-counting mechanism wouldn't influence performance much then arrays could use DJB33 until some point and then be rehashed with SipHash (or anything) if the threshold is met?
 
@tibanez Ah, fair enough. I'm going to be doing something like this, but for other data not chat, but doing my own web socket and push stuff with Ratchet in PHP
The authorisation will be on every single user message, before I handle the data
 
@Jimbo That'll be fun
 
Yeah, have done it before, just need to make it totally async and non-blocking in the event loop
No mysql calls for example, probably use a queueing mechanism and IPC via ZMQ
 
10:50 AM
That should be really fast and snappy then
 
That's the aim :)
 
AFK, in interview
Damn, the previous guy is still talking
 

« first day (1824 days earlier)      last day (3131 days later) »