« first day (2047 days earlier)      last day (2887 days later) » 

12:39 AM
is there techincal name for this..
some->thing->class->other
name for above ^
 
Adi
morning
 
@NikiC I hate this unserialize implementation with references … can we just kill serialize&unserialize ... please? please!
 
Wes
12:55 AM
@AnmolRaghuvanshiVersion2.0 object operator? :P
 
1:21 AM
no @Wes not that
let me give example
i.stack.imgur.com/ATqQP.png .... @Wes like this one marked in red
 
Wes
path? breadcrumbs? navbar?
 
yeah thanks :) breadcrumb is the thing i am looking for @Wes
 
Adi
1:46 AM
hello guys
how do you get the id in mysqli_stmt_fetch?
like this code
<a target='_blank' href='review.php?id={$record['id']}'>
 
anyone here?
 
what did I miss, why is everyone voting against callable prototypes
 
I hate it to write code I hate
I've written the ugliest code in a while for this stupid serialize thing
 
2:10 AM
@JoeWatkins I'm done for now. With a big GRRRRRR towards unserialize()
                                                old_data = Z_INDIRECT_P(old_data);
                                                if (Z_STRVAL(key)[0] == 0) {
                                                        zend_string *member, *class;
                                                        const char *class_name, *prop_name;
                                                        size_t prop_name_len;
                                                        zend_unmangle_property_name_ex(Z_STR(key), &class_name, &prop_name, &prop_name_len);
^ no sane person shall have to write code like this…
I may have some memory leak still in some uncovered edge case failures… but seen none yet…
 
2:27 AM
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!
0
Q: Catch-all route in Symfony 3

bought777I 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: "...

 
Adi
3:19 AM
@MattPrelude hello?
 
3:34 AM
@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
 
Wes
!!rfcs
 
3:51 AM
Shhhh Jeeves is sleept
sleepy
Fun fact though: Planning to improve on that command: github.com/Room-11/Jeeves/pull/55
 
4:12 AM
mornion
 
'nin
 
Ekn
mornin
 
Wes
mornin \o
 
4:31 AM
MOOOOOOIN
 
indeed
 
I think there's something wrong with this known_strings optimization in ZTS @NikiC @bwoebi
as in, it doesn't work ...
somebody forgot that compiler globals aren't actually globals ...
 
Wes
5:03 AM
i'm an idiot
lowl
will leave that in case someone wants to star it :B
 
Adi
can someone help me in mysqli prepare?
 
5:26 AM
good morning
 
5:48 AM
Moin
 
Wes
@DaveRandom review pls github.com/WesNetmo/Jeeves/blob/master/src/Chat/Plugin/…, i have no idea how to test it. it distributes the message over 2+ messages if needed, so all rfc links will be visible (ie, prevents the message to be truncated with the ellipsis)
 
6:13 AM
morning
 
Good morning
 
6:28 AM
If I don't come back within a hour or so, assume that our server transfer went bad and I murdered slapped some one.
 
posted on May 24, 2016

New Cyanide and Happiness Comic

 
@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
 
Wes
6:43 AM
@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 did a dynamic call. What happened next blew me away
 
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
 
Adi
@DaveRandom can you help me with this codes?
 
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
 
6:51 AM
@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
aye sir :D
 
@Wes For simplicity, maybe ellipsise at 3 words and if it still doesn't fit then go multi-message.
 
@Adi What's the issue you are having with this code?
 
Adi
the update query is not working
also the else statement always the result
 
Ekn
's' = string, 'i' = integer when using bind_param
 
Adi
else statement is always the result
 
@Wes can you also rebase it on to github.com/Room-11/Jeeves/pull/55 ?
 
Wes
7:10 AM
kk
 
@Adi firstly var_dump($_GET, $_POST) and make sure they contain what you think they do
 
Adi
okay i will try
var_dum($_GET, $_POST) below the mysqli_stmt_execute($stmt2);
@DaveRandom is that right?
 
I suggest you do it right at the top, but the values won't change so just any bit of code that will get executed
Also put error_reporting(-1); ini_set('display_errors', 1); at the very top
 
morning
 
Adi
@DaveRandom can you please check my whole code?
 
7:16 AM
@Adi that looks... not so nice?
 
Adi
@DaveRandomwhy?
sorry beginner here
@Naruto beginner here sory
@DaveRandom this is what i get in var_dump

array(1) { ["id"]=> &NULL } array(1) { ["submit"]=> string(6) "Submit" }
 
no worries :)
 
Adi
i got NULL in $_GET
@Naruto i will study more
 
@Adi so that is because $_GET['id'] wasn't passed to your script
It's defined as &NULL because mysqli is a crappy API, if you put the var_dump() at the very top of the script you'll see that $_GET is empty
which means that ?id= is not present on the URL that submitted the for to
 
well you can't post and get at the same time :)
 
7:22 AM
No, but you can define URL variables in a POST URL, that's a perfectly legit thing to do
it's debatable whether it's the right thing to do here
 
Adi
i added the var_dump below the if statement but still NULL value
 
@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
 
Adi
so the errror is from this line mysqli_stmt_bind_param($stmt2, 's', $_GET['id']); ? @DaveRandom
sorry @DaveRandom this is the first time i use mysqli prepared
 
No, that code would work if you were passing $_GET['id'] in the first place
Somewhere you have a <form action="script.php" method="post"> that's causing your script to be executed
 
Adi
yes
 
7:27 AM
That needs to be <form action="script.php?id=xxx" method="post"> where xxx is the ID you are trying to pass
 
Adi
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']);
below that select query is the update query
 
Yes, but the problem is not in the code you are looking at
The problem is in the page before this, the one where you submitted the form
 
Adi
this is the page before
once i click the 'click' button. it gives me the correct data. but after i click the submit button, that is where i get the error
 
@Adi Those variable names make my eyes bleed :(
 
Adi
@MattPrelude sorry that is not the official variable names that i will use. just for practice purpose
 
7:36 AM
You wont need the $record = part in the while if you're binding results.
Also best to select the columns you want by name
You're not using 19 columns so dont select 19 columns
 
Adi
@MattPrelude yes i will change it. also i removed the $record
 
Don't use @ to suppress errors
Just do
if (true === array_key_exists('username', $_SESSION))
 
Adi
@MattPrelude okay thank you :)
 
hello Room, good day to you all
can any one help me in my question
0
Q: Decoding String from UTF-8 to Windows1256

Mohammad Awni AliI 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...

 
hi @MohammadAwniAli what is your question ?
 
7:42 AM
@Adi We need the code for the form that's posting the search var
 
Adi
@MattPrelude
pastebin.com/ASR9NcLv
this the codes for the form
 
Anonymous
MOoooooorrrnuingiufdx
 
@MohammadAwniAli this is not a valid encoded text , php can't detect what is the encoding for that string
 
user image
3
 
Wes
7:51 AM
@Saitama HOLD THE DOOOOOOR
 
:P
 
@tawfekov
 
Anonymous
@Saitama haha
 
its UTF 8
@tawfekov its Either UTF8 or Windows-1256
 
8:10 AM
Morning.
 
m refgmreogvdnf
@Saitama lol
 
8:28 AM
'nin
 
@PeeHaa Did you just put a "gvd" in the room? :O .. but moin :D
 
o/
 
\o
 
Ekn
o/
 
Me: Whats sql injection?
Cleverbot: Artificial Intellingence.
 
8:35 AM
@Oldskool I think I did :P
 
ping @kelunik?
 
@DaveRandom pong?
 
@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
->then()ish I suppose
 
@DaveRandom pipe($promise, function($value) { return $value * 2; });
 
Adi
@DaveRandom can you take a look again to my codes later?
 
8:40 AM
ah cool, tnx
@Adi yes, in an hour or two (working atm)
 
Adi
@DaveRandom yes thank you. i'm stock here in my error thank you again
 
@kelunik so does this look sane?
    return pipe($this->prepare($name, $sql, $types), function($stmt) use($sql, $types) {
        return new QueryStatement($this, $this->pqConnection, $stmt, $this->mutex, $sql, $types);
    });
where prepare() creates the inner pqStatement
I could pass a stringly-types class reference in I suppose and just do new $class but I hate doing that
 
LGTM, yes.
 
cool, ty
 
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 ?
 
8:48 AM
!!? semver
google is broken?
@Joseph semver.org
!!version
@PeeHaa Jeeves seems to be dead
 
@DaveRandom thank you Dave
 
@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
@DaveRandom from what country are you?
 
UK
(check profile ;-)
 
9:01 AM
On which planet?
 
Adi
@DaveRandom please check my codes later after your work. thank you! haha
 
@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
 
Adi
i have two queries and in the first query the id is defined but in the second query, the id is no longer defined
 
Either your queries are on two different pages (scripts) or you are mistaken - the ID isn't going to get undefined
 
Adi
both queries is in the same page.
 
9:11 AM
seriously, if you var_dump($_GET); at the very top of the script - the very first line - you will find that it's empty
that's what you need to fix
and the way to fix that is on the previous page, the URL that the form is being submitted to action="" on the <form>
action="script.php?id=xxx"
 
@DaveRandom and possibly the name of the form element that you're drawing the id from.
^ or that
 
Yeh I mean you could also submit it in a form field
 
Adi
i already use the var_dump($_GET) at the top of the page and it gives me the right output. and then try it in the second query and then NULL value
 
There are really good reasons not to just put the ID to a page that mutates records in a link
i.e. some antivirus etc will auto click it.
 
tbh it doesn't make a huge difference, but I'm actually inclined to use a URL param for an ID (much like /user/<id>/update endpoint has the ID in URL)
 
9:14 AM
@DaveRandom Well yes, but you wouldn't use a GET request for that ;)
 
I prefer /user/<id>/update over /users/update
 
Adi
$query = "SELECT * FROM `crew_info` WHERE `id` = ?";
$stmt = mysqli_prepare($conn, $query);
mysqli_stmt_bind_param($stmt, 's', $_GET['id']);
var_dump($_GET);

gives me a correct outout
 
I prefer to PUT/POST if I'm changing anything.
 
Adi
if(isset($_POST['submit'])) {
include 'config.php';
$query_update = "UPDATE `crew_info` SET `crew_status` = 'NEW' WHERE `id` = ?";
$stmt2 = mysqli_prepare($conn, $query_update);
mysqli_stmt_bind_param($stmt2, 's', $_GET['id']);
mysqli_stmt_execute($stmt2);

this one gives me NULL value
 
then do a 3xx redirect to a confirmation page.
 
9:15 AM
@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.
 
@MattPrelude That's true, but I'd always check the request method anyway
Well, what I mean is that my routing layer would reject the request to that endpoint with the wrong method
@Adi mysqli has a sucky API, try a bit of var juggling, maybe it's just insane enough to actually break the var
 
$userId = $_GET['id'];
mysqli_stmt_bind_param($stmt, 's', $userId);
in both places
 
Adi
tried that also but no luck
 
9:21 AM
@Adi replace your entire script with this and paste the output please:
<?php
error_reporting(-1);
ini_set('display_errors', 1);
var_dump($_GET, $_POST, $_SERVER);
/*
just comment everything else out
 
Is PDO not a lot easier to pick up than mysqli_*?
 
gzip: 2016-05-23.log: No space left on device
 
and pastebin the output please, it will be long
@iroegbu fuck yes
 
@iroegbu I'm currently reading that. So far it's an interesting read, yeah.
 
Okay /adds to cart
 
Adi
9:26 AM
@DaveRandom here pastebin.com/212Z4Niv
 
@Adi You didn't POST there
 
@Oldskool thanks
 
> ["REQUEST_METHOD"]=> string(3) "GET"
So your $_POST array is empty
if(isset($_POST['submit'])) {
^ need to see what will happen when you would hit that line
So submit the form that activates that code
Or is it the same form?
wait @Adi what is the name of that PHP file?
is it review.php?
so that form is submitting back to the same script?
 
Adi
review.php and pending_crew.php
 
Which one is pastebin.com/JyyPbJwW?
and what does the other one look like?
 
Adi
9:29 AM
review.php
this is the pending_crew.php pastebin.com/LVrNbdFV
 
OK
moment
 
http://stackoverflow.com/questions/37388737/how-server-interact-with‌​-device-remotely
 
Adi
@DaveRandom thank you
 
http://stackoverflow.com/questions/37388426/cybersource-how-to-add-m‌​erchant-defined-data-field-in-woocommerce
 
@Adi change <form action="review.php" method="POST"> to <form action="review.php?id=' . urlencode($_GET['id']) . '" method="POST">
And you really, really need to go read about the post/redirect/get pattern
And separation of presentation and business logic
 
Adi
9:35 AM
@DaveRandom thank you. that confuses me big time
 
@Adi It actually wouldn't be as confusing if you implement post/redirect/get and separate your HTML from your database logic
Code is very hard to think about when it does more than one thing
You have two distinct roles there: displaying data, and updating data
the code to update the database does not belong in the same place as the code to display it
I do remember it taking me a long time to wrap my header around that at first though
 
Adi
@DaveRandom i know right now this things are not easy for me. im just starting my php adventure. haha thank you again
 
So, who of you will be at phpuceu this weekend? Only Jimbo?
 
@DaveRandom Why did you kill him :(
!!version
oh well.. I'm out right now so not much I can do :(
 
@PeeHaa I'm guessing it's a deadlock, when did you last deploy?
 
9:44 AM
sunday somewhere I think
 
Which is current head of master
I did have some deadlock issues at one point, maybe I missed something, will take another look
 
In my experience when @Jeeves dies it's because of a actual crash
 
let me know when you can determine if the proc is still running
(maybe the server has just fallen over)
@PeeHaa yeh but haven't you got it on a systemd restart?
 
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"
 
I did also have some issues where SO was misbehaving and eventually bailing out, so maybe it's just that
In fact I don't think we've got any reconnect logic atm
If we have then I haven't tested it
 
9:49 AM
Might be. I'm going to look into setting up log rotate properly and use another logger instead of the current null logger on production :)
 
Well for the sake of simplicity can just use stdout logger and >> phpzomgwtfbbq.log
It will only work if you use that exact file name though
:-P
 
http://stackoverflow.com/questions/35788243/can-rip-do-load-balancin‌​g
http://stackoverflow.com/questions/37386900/how-to-schedule-my-table‌​t-sleep-and-wake-up-automatically
 
@DaveRandom :P
@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
 
Just add a command to cron to clear the file if it exceeds a certain size or date :P
 
neh logrotate ftw :)
 
9:58 AM
TIL
 
./
 
@PeeHaa yeh just keep a week-10 days worth of logs, we aren't going to need more than that for the time beign
I'd really like to get moving on the web ui
If we put an aerys instance into the same loop it'll be super-powerful I think
 
@DaveRandom Yeah same here.
 
That's really the last piece of the multi-room jigsaw, need a way to define thinks like twitter oauth creds per-room
The join/leave etc stuff is basically just wiring
 
@JoeWatkins might well be ...
I didn't review that particular commit
And as nobody tests actually multithreaded ZTS, nobody notices :P
 
10:11 AM
guess apache friends will eventually open a report about it, it must break apache
 
@bwoebi I know ... serialize reference handling is extremely stupid
Causes a huge amount of security issues and one of the main things making unserialization slow
And would've been so easy to avoid that ...
(assuming perfect hindsight, of course ^^)
 
morning
 
'nin
 
10:32 AM
@DaveRandom Why the same loop? Why not a separate process.
 
@kelunik Simplicity, really, no IPC required.
 
@DaveRandom I don't think that works really good. Only if you restrict Aerys to a single worker.
 
@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
dunno, open to persuasion
 
@DaveRandom Redis?
What do you need IPC for in the web UI?
What should the web UI do at all?
 
10:36 AM
@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
 
Could also use simply UDP to send the notify.
 
which need to be per-room, and can't be set by dumping secret data into chat history
 
twiiterSecret: sdkhfkj43y583768436 #yolo
 
lol
@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
 
@DaveRandom The protocol can be as easy as any packet received triggers a reload. ^^
 
10:41 AM
since redis and pg both have mechanisms specifically designed for things like that
@kelunik well we can implement all 3 :-D
And by then I'm sure we'll have come up with even more work avoidance techniques
 
@DaveRandom Yes, but having no dependencies is also nice.
 
@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>
 
@DaveRandom Why does it even have to be atomic?
@Jeeves is single threaded anyway.
 
10:59 AM
@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.
 

« first day (2047 days earlier)      last day (2887 days later) »