Hey guys, I have a question regarding Symfony3 routes. Was hoping someone here might be savvy and take a look. Would greatly appreciate any input. Thanks!
I have a catch-all fallback route in Symfony2 that I couldn't get to work in Symfony3. I tried this exact syntax (a verbatim copy of my Symfony2 route) and that didn't work.
fallback:
path: /{req}
defaults: { _controller: MyBundle:Default:catchAll }
requirements:
page: "...
@Andrea Well, only 11 people have voted so far. I'm not sure I'd count that as "everyone"
For my part, I don't like the look of it. Don't much care for Hack's either, fwiw.
I'd kinda like to see something a little more like type aliasing.
type MyCallback = function(string,int): bool;
function foo(MyCallback $cb) { ... }
Baring that, I do at least prefer Hack's inline callable typing over what's presented.
function foo((function(string,int):bool) $cb) { ... }
The RFC being offered turns "callable" isn't some weird drop-in replacement for "function" when used as a typehint (but nowhere else). And it doesn't deal with nesting/chaining at all.
function foo(callable(string,int): callable(callable(void): bool) $cb) { ... } That's parsable, and unambiguous, but it's unreadable as hell.
Again, not that it'd look much better without type aliasing anyway, but still.
Heh, looking at the mailing list. @Danack seems to have voted for the same reasons. :p
@DaveRandom review pls github.com/WesNetmo/Jeeves/blob/master/src/Chat/Plugin/…, i have no idea how to test it. it distributes the rfc-vote message over 2+ messages if needed, so all rfc links will be visible (ie, prevents the message to be truncated with the ellipsis)
@Wes What about just ellipisising the link text so they all fit instead?
basically multiple messages feels like it's going to be complex to manage and flaky
can give it a go if you want, will load it up locally and test in a bit
btw @Wes all you need to do to test is create a local clone and configure it with your own SE openid credentials... you can just create a room for it, and it works fine if you run the bot as yourself and log in from a browser as well
Also it runs fine on win, you just need PHP7 w/mbstring
@DaveRandom i could try that, do you think it's better? i prefer labels to be all visible. consider that it will be rare to get more than 1, 2 messages
@Wes Well that's just it, because it's so rare that you'd hit it anyway. Like at the moment I think the only things that would be ellipsised (haven't checked) would be Closure from callable... and Forbid dynamic calls... which (I think?) convey enough information to me it understandable
"Forbid dynamic calls" is a little bit click-bait, but that's not necessarily a bad thing with RFCs IMO. People should read them.
Plus if you mouse-over you can see the full title in the URL, usually
I'm not sure it's worth adding the extra layer of complexity to track multiple pins is all I'm saying, but if you can make it work reliably I'm not against the general idea @Wes
that should work though @DaveRandom and if it doesn't must be fixable easily :B but i don't disagree with ellipsis-ing the long labels. will try doing that later this morning
@Adi I can't promise to help you before I've seen the problem, because I might not know how to solve the problem... but if you post the problem then maybe I or someone else can help you... please use a pastebin for long code
I am, however, going to make a cup of tea and have a cigarette, so you'll have to give me 10 mins anyway
@Adi the mysqli_stmt_bind_param($stmt2, 's', $_GET['id']); actually creates that NULL value, which is confusing. If you put the var_dump() as the very first line in your script you'll see it's empty
i have this select query $query = "SELECT * FROM `crew_info` WHERE `id` = ?"; $stmt = mysqli_prepare($conn, $query); mysqli_stmt_bind_param($stmt, 's', $_GET['id']);
I have the code below, which tries to convert a string from UTF to CP1256. I want to decode the string to arabic, and the page encryption is fixed to UTF8
<?php
$string = "ãÍãÏ Úæäí ãÍãæÏ Úáí";
$string = iconv("UTF-8//TRANSLIT//IGNORE", "Windows-1252//TRANSLIT//IGNORE", $string);
echo $s...
@kelunik I have a promise, how do I wrap that into a new promise that will take the success value of that inner promise and return a new value based on it
basically can I do $var = yield $promise; return new Thing($var); without the co-routine overhead
Hi can any one give me an insight of how to version a php project ?? I mean how can i chose between v 1.1 and then 1.2 ... or 1.0.1, 1.0.2 ... or 1.01 , 1.02 ... are there any stantdards for versioning ?
@Joseph Note that there are other approaches (coincidentally I only yesterday read JetBrains' blog post on how they changed their versioning system and why) but semver works well in the PHP eco-system, for libraries in particular, because composer has good support for it. For the UI layer it can be difficult to work out how to apply semver because "APIs" don't quite have the same meaning there
The most important thing is that you define a rigid, unambiguous set of rules and follow them. As long as what you are doing makes sense - you can explain it to other people - then that's what matters.
@Adi You need to focus on that $_GET['id'], that is why your code doesn't work, because it's not defined. You need to figure out why it's not defined and define it.
Experiment with submitting forms and how different things change the values in $_GET and $_POST
@MattPrelude It's a POST request, but I'd prefer the user ID in the URL. Whether that's in a query string param or the uri path doesn't make any difference at all really, that's just rewriting basically
I'd find that easier to read as an API consumer, so I'm generally inclined to make my APIs work like that (even app-local ones)
@DaveRandom But by making it a POST you avoid the issue of a link being clicked and accidentally updating something, my point was more that his current design with some plugins (i.e. those that check links for malicious software) will end up having lots of links auto-clicked and lots of records updated accidentally, in production.
Yeah but sometimes retries fail for some reason (broken connection to chat) and after n times systemd just thinks "fuck you and your stupid bot I'm out of here"
@DaveRandom Yeah, but my experience with just dumping shit in a log file is that I have to cleanup a 100G file at some point in time when I have forgotten all about the bot :P
I could also just use journald but that things confuses me
@kelunik we can have a single worker that's responsible for the IPC
If we tie it to pgsql (so we can hijack listen/notify) it would be relatively simple and could be done separately, but if not then we'd need some kind of IPC mechanism, probably some crazy socket protocol or something, and it would be way more complex
@kelunik Well yeh, or that, can implement both, but need something that has a sane notification mechanism
@kelunik Well I would like the web UI to allow people to enable/disable plugins, map commands etc
Which at the moment is persisted to file but the file is only touched at startup and when stuff is changed, we don't check the persistent store for every message
So all we need is a notifier to say "reload your config from persistent store" but it does need some kind of notify
we don't need to pass complex data, only "something has changed, reload"
@kelunik The reason we actually need a web UI is because of things like setting the twitter oauth creds
@kelunik yeh but then we need a protocol and it all gets a bit messy, I'd be happy to impose a limitation of "if you want the web UI to work, you need a pgsql/redis back end"
and we could easily implement both of those and you can choose one
Basically this is one particular wheel that I don't see the need to reinvent
@kelunik I made the JSON file store access atomic over the weekend. It was... not fun. It's also pretty inefficient, but it can work for a dependency-free model
like amp has ev/uv etc, but also select() for people who cba setting all that up
@PeeHaa if it is deadlocked, that file store access is a good candidate for the culprit actually, that whole thing needs code review because <i_have_no_idea_what_im_doing_dog.png>
@kelunik The plugin partitioned key-value store needs to be atomic, because two plugins may try to update something at the same time, it's stored in the same file.