« first day (1781 days earlier)      last day (3161 days later) » 

7:00 PM
$_SESSION['username']=$username;
$_SESSION['logged']=1;
$date = date('Y-m-d H:i:s');
$query = "INSERT INTO user
          (last_seen)
          VALUES
          ('" . $date . "')
          WHERE user_name = '" . $username . "'";
         mysql_query($query, $db) or die (mysql_error($db));
header('Refresh: 5; URL = main.php');
echo "Login successful, redirecting...";
die();
will someone please explain this code to me?
 
@Abe on that keming - you don't think the gap between the g and l is just a tad much?
 
@Abe awesome, they finally found a nice font for their logo.
 
@PaulCrovella lol
 
i know the query isn't correct as it must be update instead of insert
but above code
how it works?
how it saves login time in database?
 
@HassanZia That is what you want to do upon successful authentication..... and it should probably be update instead of insert
 
Abe
7:02 PM
lol. again seriously, there's people that cares of this sort of things. and a lot, i mean
 
.....
 
@Asperger well ,,, i know how to save time in db, but don't know how to track when user logs in
 
$user = $userRepository->getUserByName($username);
if(password_verify($password, $user->getPasswordHash())){
    $_SESSION["current_user"] = $user;
    $_SESSION["last_login"] = $user->getLastLoginTime();
    $user->updateLoginTime(time());
    $userRepository->save($user);
} else {
    // GTFO you failed authentication
}
 
Do you want to display when the user logged in?
 
Abe
@Danack it's not that bad actually. it's just the big G that doesn't seem to be part of the same font
 
7:03 PM
@Asperger yup
 
Like have it in your database? Like user Edward logged in on 29th of june etc?
 
like "you were logged in on 1st sep last time"
 
$day = date('Y-m-d');
 
or just CURRENT_TIMESTAMP in the sql
 
@PeeHaa multiple autoloaders is screwing up the setup
 
7:05 PM
wow, this seems some logical
 
@Abe The angled e is just naff imo. And it is very likely that they realised that the rest of the logo is completely boring, so they decided to spice it up by that 'dramatic' angling.
 
$query_login = "UPDATE X
SET X = '$day'";
 
current time stamp
 
time stamp
works too
 
@Mr.Alien They should just stack
 
Abe
7:06 PM
@Danack ahaha, yeah, and that. would have been much better if it was flat
 
Unless you are using __autoload
 
that is weird... neh am using spl.. and my loader is searching for sessions file which is weird
 
Sounds like your loader is broken :)
 
aah got it wait
 
Abe
@PaulCrovella i just noticed the "keming" :D
 
7:07 PM
@HassanZia UPDATE users set last_seen = CURRENT_TIMESTAMP where username = ?
 
ok what i've to do is
get date when user logs in
get time when user logs in
save into db
show the message


////////////////

this ain't that simple for me
 
Abe
you see, i won :P
 
hehehe bitching about kerning and not seeing it :P
 
Abe
:P
 
7:08 PM
@HassanZia Do every part of it separately
Only way to learn is doing it
 
@Orangepill thank you :)
@PeeHaa correct
well again
confusing part
ok i save it in db "current timestamp"
then i go and show the mesaage
but it will show that when user gets logged in by this time
 
Abe
do you guys use namespaces just to shorten those names that should be just class names?
 
No
 
Abe
good
and you hate who does that? :D
 
i mean to say
for example i logged in last time on 30th aug, and now i login again today
 
7:11 PM
@HassanZia Store the previous time in the session upon log in
 
I don't shorten things, abbrevations are evil :D
 
@Abe Depends on who it is ;-)
 
the message which would appear would be you are logged in today instead of 30th aug
ahan
ok like this
 
Abe
i'm trying to shorten some names but i can't come up with anything decent. only option is using namespaces i believe. i have a name that is 42 chars long O_O looks like java
 
select last_seen from users where where user = user
$_SESSION['last_seen'] = $row['last_seen'];
update users set last_seen = current time stamp where user = user
 
LGL
7:15 PM
@tereško I made PDO connection and now is faster
Why it depends?
 
will it work

select last_seen from users where where user = user
$_SESSION['last_seen'] = $row['last_seen'];
update users set last_seen = current time stamp where user = user
 
Have you tried it?
 
@LGL the primary difference is that PDO does not have asynchronous functionality, but instead it provides common interface for interacting with various RDBMS'es
 
@HassanZia That's why you need to save the value that exists in the row prior to doing the update. $_SESSION would be a good place to save this.
 
I am not a PHP interpreter
7
 
7:18 PM
@Orangepill so i hope the above code would work?
 
@PeeHaa I thought you were drunk all the time?
 
@hassanzia it should...
 
Abe
@PeeHaa peehpaa -q index.php
 
@FlorianMargaine I cannot deny nor confirm these accusations
 
7:18 PM
@Orangepill anyways thankx alot :)
 
@PeeHaa so, you are a PHP interpreter.
 
I like to refer to my previous statement :P
 
heh... nice one
 
;)
 
Abe
@PeeHaa ?
 
7:20 PM
@Abe Look again at the results ;)
 
LGL
@tereško I see, any other useful benefit? I should be aware or further headace :)
 
@PeeHaa So, I just need to drop in PHP code in future here with a @PeeHaa ping and you execute the code into this chat?
 
@bwoebi That would actually be pretty fucking awesome
Like cap for JS
 
Abe
@PeeHaa the fact that "kerning" appears with larger kerning? :P
 
@PeeHaa so… let's try it… die();
 
7:21 PM
@Orangepill is there any way to get the date and time separately from the timestamp?
 
lol thanks bob :P
@Abe Yeah :-)
 
@PeeHaa actually doable with 3v4l
 
@FlorianMargaine Does it haz api?
 
no idea
 
Abe
@PeeHaa it is barely noticeable on windows
 
7:22 PM
@LGL well, yes: one. When used for MySQL, PDO will by default emulate prepared statements, which you must disable. It was a stupid decision made, when introducing PDO in PHP codebase, because at that time there was a large install-base of pre-5.1 MySQL servers.
 
@Abe Use a proper browser
 
@PeeHaa :-D
 
@HassanZia date and strtotime
 
Abe
*proper os
 
it's totally noticeable on windows
 
7:23 PM
Windows is proper
< 8 that is
And > vista
 
i'm using varchar currently to save date and time in proper format
 
don't listen to the guy who didn't catch the keming joke
 
:D
 
@PeeHaa XP is also quite nice TBH…
 
Abe
 
7:24 PM
@bwoebi XP was for that time decent indeed
 
@PeeHaa well...
 
2000 too
 
@PeeHaa proper must mean something different where you live.
 
@Orangepill :P
@FlorianMargaine Yeah true that stuff is scary as fuck
 
LGL
@tereško how do I disable it?
 
7:25 PM
But hey! They are doing is to improve the user experience they said!
 
Abe
 
@LGL you need to do this: $PDOinstance->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
google for more info
 
@Abe lol
 
Microsoft really sometime has to learn to make each iteration the new best and greatest product they've ever made, just like Apple does…
 
I'm going to pronounce it googlé from now on.
 
7:26 PM
@FlorianMargaine I have been thinking of migrating to Linux or BSD as my primary OS
 
@tereško do eet :)
 
@FlorianMargaine bad AMD support .. but it might change with Vulkan
 
@bwoebi I hate mac updates. I'm always afraid something in my stack breaks and often it does just that
 
LGL
@tereško yeah I'm reading about it now. Thanks
 
@Danack how do you pronounce the é in English ?^^
@PeeHaa or linux/windows updates better??
just don't update, then you're safe.
 
7:27 PM
sorry for 3 pings ..
 
@bwoebi agreed
 
@bwoebi never had an issue with linux updates, but well
 
@bwoebi Well what helps is what I use my mac for and what I use linux/windows for
 
@teresko for as much gaming as you do that might pose a problem
 
@bwoebi with an outrageous French accent.
 
7:28 PM
My experience with mac's are only for ios development which seems brittle
 
@Danack ah okay
 
@Danack like, marseille's accent?
 
Windows has never broken my simple text editor and linux has never broken my webserver (I do that myself thank you very much)
 
@FlorianMargaine French accent is French accent… regional differences don't matter.
 
@PeeHaa you can also use them for gaming
3
 
7:29 PM
@FlorianMargaine Possibly - like this: youtube.com/watch?v=9V7zbWNznbs
 
I probably will have to implement full network infrastructure, before I migrate to win10 ... if I decide to make that leap. The news have been discouraging.
 
@PaulCrovella :D
Semi related: I watched citizen four yesterday
 
@PeeHaa It does… just in more subtile ways… like things are sometime deprecated… everything works well, you never check the logs and then everything stops working after some update…
 
Abe
agh. the favicon
 
@bwoebi I never had a broken webserver which was not entirely my own fault.
Only using official repo stuff for most things helps a lot with that
And it's not like I do fancy stuff like at all
 
7:32 PM
Bah, if you only ever do boring stuff… then you never get the interesting bugs!
 
yeah, it's not like you run php7 or something
 
@bwoebi hehe
 
@FlorianMargaine running PHP 7 since September in production
(September 2014 btw.)
 
@FlorianMargaine not in production (yet) ;)
 
@bwoebi I'm on debian unstable
I'm wild
 
7:35 PM
Also running 7 is the least I can do to find possible bugs :)
 
good evening ladies
 
good morning ladyboy
 
Heya @hakre o/
 
@rdlowrey Don't remember if you've answered – when do you start work at Grovo?
 
in a couple of weeks iirc?
 
7:39 PM
@LeviMorrison two weeks. You really should be more active in Niklas' chat…
 
^^
Lately I've been a stranger for the most part even here.
 
Would supporting this make any sense for a true DIC? Seems like it would only be useful for service locators
 
I wonder about the same thing just the other day @Orangepill
 
@Orangepill I am agree with you very much
 
@Orangepill for a DIC you want people misusing, sure
 
7:55 PM
^ that
 
I was thinking it would be trivial to write an adapter from auryn to conform to that interface... but that would just enable people to misuse it.
 
@Orangepill it was supposed to be PSR-7
 
@Orangepill I have thought about trolling flowery and creating a github account to open an issue about it on the repo :p
That is how exciting my life is...
 
@PeeHaa I encourage it
 
7:57 PM
you dont even have to make a new account
it's fair to open a issue
The interface not does not seem fitting
 
Well I think I fixed all my issues. Instead of using name="tripinfoid" I was using id="tripinfoid" so it didn't work
 
8:18 PM
@tereško why didn't it happen then?
 
@bwoebi of that I am not sure, but this was supposed to be a PSR for DI containers
as you might suspect, I don't really pay much attention to FIG
 
@tereško me neither… the only thing I'm grateful for is the autoloader standard…
 
@bwoebi The one that doesn't need documentation to use
 
@PeeHaa IMHO, if provided signatures only, you can understand both…
 
Oh I never actually looked at the fig thing tbh :P
 
<.<
 
It better allowed method chaining!
 
8:38 PM
It doesn't? Shitty!!!
 
@bwoebi I'm real proud of this (and its usage)
 
I actually agree with Stas and Lester about a thing. This makes me profoundly uncomfortable.
 
@Charles As long as it's unrelated to ~>…
 
@bwoebi As discussed before, I find lambda operator forms with right arrows to be entirely illogical and very difficult to parse.
 
@Charles so, $fn = ~> ($x) $x * $x; would look better?
 
8:44 PM
@bwoebi ($x)~> maybe. Honestly I kinda like the alternative syntax Rowan Collins proposed, lambda($args, body) / lambda($args, { body})
 
@FlorianMargaine `(dpkg-cache ,key #'(lambda () ,@body))) I don't understand that symbol magic ^^
 
@bwoebi PHP is not lisp.
 
@Charles I honestly find it quite awkward and a step back.
 
I don't dislike the purpose of the idea, it's just the syntax feels so amazingly jarringly out of place in PHP.
 
@Charles he was replying to me
 
8:45 PM
@Charles wrong ping^^
 
oops
 
@bwoebi do you want me to explain?
 
maybe an interpretive dance would help
 
@FlorianMargaine yes, please
 
@bwoebi in 10-15 minutes or so? busy right now
 
8:47 PM
@FlorianMargaine fine
 
@Charles I think it's just because you're not used to it. right arrow stuff is preferable to the "inside out" closures we have right now, where you have to read from the inside to the outside for what it's doing.
 
what about ~($args, body)
 
@bwoebi Given the context PHP, it fits in with the language better, is mostly clear (exceptionally so with the curlies), is googleable, and is self-contained. There's no difficult-to-google symbol, the args list is in a familiar place, etc.
 
Java programmers have infected PHP
 
@r3wt Java? why?
 
8:49 PM
@r3wt If you just called me a Java programmer, you can kindly go jump off a cliff.
2
 
@bwoebi just the feeling i've been getting after looking at the codebases of laravel and zend2
then reading the PSR-7 horse shit
 
@r3wt ah, these frameworks and PSRs… yeah.
 
@r3wt I think PSR7 isnt that bad TBH. At least they got the mutability part right
 
heck, the people were often educated with Java and then indoctrinated to its OO…
@ircmaxell it's not bad, it's just overly complicated/doing too many things.
 
@ircmaxell what do you think about user input vars being placed into a single variable?
 
8:52 PM
Complex class hierarchies aren't a symptom of being a "java programmer." They're a symptom of a complex codebase.
 
ThW
@r3wt user input?
 
@Charles the codebase is complex because the class hierarchy… e.g. github.com/thephpleague/climate/tree/master/src ...
 
@r3wt if appropriately abstracted, sure. But I also want to know that a var comes in via request body and not URL or potentially cookie.
 
Complex code isn't an excuse to make things use complex hierarchies. Getting complex is easy… making it simple… hard. Refactoring it to be simple… even harder.
 
8:55 PM
if you look at what slim's doing, $_GET and $_POST are now $request and any args in the URI are in $args i just don't like that.
but, it is easier and makes writing rest services simpler.
 
ThW
@r3wt default is gpc isn't it, so cookies override query string and request body
 
@r3wt I'd rather see a transformer that maps it for me, rather than doing it myself
 
@r3wt yay, slim making it impossible to guard against basic CORS protection, because everything can be passed as get…
 
@bwoebi well, there are other ways to do CORS, but yeah
 
@bwoebi I'm back
 
8:58 PM
@ircmaxell sure, but just forcing POST is a very easy protection…
 
@bwoebi so, you know about lists, right?
CL-USER> (list 1 2 3)
(1 2 3)
this is a list ^
 
ok
 
@bwoebi "protection" :-P
 
another way to write this
 
ok, off to do a talk, later!
 
8:59 PM
CL-USER> '(1 2 3)
(1 2 3)
it's the quote
it just passes the rest without evaluating it
 
ah ok
 
if you don't have a quote, it will think 1 is a function and call it as such
the thing is, the quote will literally stop everything afterwards from being evaluated
 
That I know… hence was wondering
 
but sometimes, you want to not evaluate most of the things, but still evaluate a bit inside
so you have the backtick, or quasiquote
(let me build an example in the repl)
CL-USER> (defvar *foo* 1)
*FOO*
CL-USER> '(1 *foo* 3)
(1 *FOO* 3)
CL-USER> `(1 ,*foo* 3)
(1 1 3)
is that part clear?
 
9:01 PM
good one :P
 
@bwoebi as you guessed, the comma is to say "evaluate this part in a quasiquoted form"
 
@FlorianMargaine yes
 
the thing is, we're playing with forms all the time, so there's another operator, the slice operator
CL-USER> (defvar *bar* '(1 2 3))
*BAR*
CL-USER> `(1 ,*bar* 3)
(1 (1 2 3) 3)
CL-USER> `(1 ,@*bar* 3)
(1 1 2 3 3)
 
basically a splat operator?
 
9:04 PM
Guys
My PHP code was working on my local host from wamp
 
now, the #' is the same as the quote, except it's for functions
 
but now that I am hosting it on a web server it won't allow get_result to work?
 
but it says "get the function reference"
 
I get this errpr Fatal error: Call to undefined method mysqli_stmt::get_result() in /home/matthswk/public_html/socialnet/pagecontent/navigationbar.php on line 20
 
which you can apply or funcall
CL-USER> (defun foo ())
FOO
CL-USER> #'foo
#<FUNCTION FOO>
CL-USER> 'foo
FOO
the difference ^
the quote gets the symbol, the hash-quote gets the function reference
 
9:05 PM
I understand
 
so... for this:
(defmacro use-apt-cache (key &body body)
  `(apt-cache ,key #'(lambda () ,@body)))
 
@Matthcw Judging from the comments on the get_result manual page, your host isn't using the modern mysqlnd driver. You'll need to adjust your code accordingly, or find another host.
 
it means that at compile time, use-apt-cache will return a list which first element is apt-cache, etc
 
FUHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
 
e.g. for (use-apt-cache '("foo" "bar") (print "baz") (print "qux"))
at compile time, this will be extended to: (apt-cache '("foo" "bar") #'(lambda () (print "baz") (print "qux")))
so it's convenience that I don't have to write the #'(lambda () ) every time
which isn't needed for the code I'm writing
I just care that I'm using the cache
 
9:09 PM
@Orangepill yeah, can't seem to find the link to gratipay's "pay" or "give"
 
@ocramius was wondering about that myself...
 
Just one thing is still puzzling me
 
lamdba function only takes two params, the args list and the code… but you actually expand body variable and then it's passed 3 params?
 
@bwoebi sorry, I don't understand what you're saying
 
9:12 PM
@Charles @Charles do you mind saving me some stressalisation, and tell me some modern hosts?
 
@Matthcw I actually don't have any good shared hosting providers that I know aren't horrible. I personally just do VPSes and manage it all myself, but that only works because I already know how to do this.
 
Wait... VPS hosting means YOU control the server?
 
(lambda () ,@body) you're applying splat operator to body variable here, so, you end up (in your example with (use-apt-cache '("foo" "bar") (print "baz") (print "qux")) to have (lambda () (print "baz") (print "qux")) ? but lambda only takes two operands, no?
 
Damn, i thought shared had all the benefits
 
@bwoebi ah
(lambda ()
  (foo)
  (bar))
is perfectly valid ^
is that what you mean?
 
9:14 PM
yes
 
is that just a list of statements then?
 
it's valid, lambda is a construct to have anonymous functions
 
@Matthcw In most cases, yes this is true. But control comes with responsibilities, including security updates, etc.
 
@bwoebi yeah, executed one after another
just like any function
 
9:15 PM
ah okay.
 
(defun foo ()
  (print "foo")
  (print "bar"))
perfectly valid too
 
lisp likes it's parenthesis doesn't it.
 
yeah, makes sense now
 
@Orangepill meh, it's boring… they should also use [ and { sometimes…
 
9:17 PM
@bwoebi clojure has that :P
 
^^
 
I also made a thing to use {} for hash tables too
but didn't really like it
 
@FlorianMargaine hahaha
 
@bwoebi try scala, it's like every possible existing syntax in a single language
 
@Ocramius TIL scala can interpret PHP.
 
9:19 PM
oh yeah... I ended up completely ditching the {} thing in my lisp project
(I was trying to find it...)
 
If I'm using php-fpm and plan to keep using it - is there any conceivable cases when I'd want to use ZTS ?
(I actually have managed to avoid thinking about ZTS for the longest time)
 
Oh, the thread about short closures rfc on reddit landed on /r/subredditdrama …
@Danack the only reasons are given to you by Joe
 
Does anyone know how I can loop through an associative array like $row['username']
 
@Matthcw foreach
 
9:34 PM
Thanks
 
array_merge_column(&$array,$source,$column); would be a sweet function
array_column_sort(&$array,$column); is also on my wishlist
 
do you want $array + [$column => $value] ?
 
no, why would i want to union a column into an array?
these are functions that make since when working with multidimensional numeric arrays.
ie, database results
 
@r3wt Why do you want all those array functions which can easily be achieved in userland?
If anything imo we should kill half of the array functions we already have
 
could probably slip them in and nobody would notice the difference
 
9:49 PM
@PeeHaa why does any language has a standard library?
 
what the fuck are you even talking about?
and what would those "magical function" there even do?
you obviously are not willing to actually explain what you want
 
is it not obvious?
 
no
 
not sure why you two spend so much time flaming me
 
@r3wt Not to do all the things
I would say php's standard library already has most that is ever needed
 
9:54 PM
@PeeHaa and most of these array functions were written in a time when people were still using while($row = ...) to access database results, so these functions wouldn't make sense.
 
:/ it's been 7 days and I still couldn't become friend of rust's syntax + the compiler is a bit slow...
 
And stuff like array_column_sort is one single line in userland
 
@PeeHaa is it really? please enlighten me
 
Even shorter with the jizz operator
 
@r3wt most of people are still using while() to access query results
 
9:55 PM
@r3wt I assume it sorts based on a specific column right?
 
array column sort would be useful.. but with usort and the spaceship operator it is trivial to implement
 
yes, sir
 
also, I would like to note, that you still havent actually explained what those two functions would actually do
 
@Orangepill when does spaceship land?
 
7... so in november
 
9:56 PM
last thing i heard it was just an rfc
nice
 
it's been accepted... surprisingly one of the most touted features of 7
 
@r3wt usort($arr, ($a, $b) ~> strcmp($a['col'], $b['col']));
 
Stupid "comment is too long by 2 characters." ...
 
I'm kinda guessing the syntax because I'm not really used to it
 
@PeeHaa see… you got it right… it's that intuitive!
 
9:59 PM
:P
 
@tereško array_column_sort would sort an array based on the value of a single column , for instance i would like to sort an array of several merged db results. array_merge_column would merge a single dimensional array into an multidimensional array as a new column
@PeeHaa, new closure syntax eh
 

« first day (1781 days earlier)      last day (3161 days later) »